Skip to content
Browse files

Prepping for github

  • Loading branch information...
1 parent 784d74e commit ae83b03f63646e839bf4a705cda3509618e2cc90 Troy Davisson committed Jan 28, 2011
Showing with 126 additions and 4 deletions.
  1. +122 −0 README.md
  2. +1 −1 examples.php
  3. +3 −3 flexmlsAPI.php
View
122 README.md
@@ -0,0 +1,122 @@
+flexmls API
+=====================
+A PHP wrapper for the flexmls REST API.
+
+
+Documentation
+-------------
+For full information on the API, see http://documentation-url-goes-here.com
+
+
+Usage Examples
+------------------------
+ # include flexmlsAPI.php and set up instance of flexmlsAPI
+
+ require_once("flexmlsAPI.php");
+ $api = new flexmlsAPI("api_key_goes_here", "api_secret_goes_here");
+
+ # identify your application (optional)
+ $api->SetApplicationName("MyPHPApplication/1.0");
+
+ # authenticate
+ $result = $api->Authenticate();
+ if ($result === false) {
+ echo "API Error Code: {$api->last_error_code}<br>\n";
+ echo "API Error Message: {$api->last_error_mess}<br>\n";
+ exit;
+ }
+
+ # get your listings
+ $result = $api->GetMyListings();
+
+ # see the included examples.php for more complete usage
+
+
+Error Codes
+---------------------
+<table>
+ <thead>
+ <tr>
+ <th>HTTP Code</th>
+ <th>flexmls API Error Code</th>
+ <th>Automatic Retry</th>
+ <th>Description</th>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <td><tt>401</tt></td>
+ <td><tt>1000</tt></td>
+ <td><tt>Yes</tt></td>
+ <td>Invalid API Key and/or Request signed improperly</td>
+ </tr>
+ <tr>
+ <td><tt>401</tt></td>
+ <td><tt>1010</tt></td>
+ <td><tt>No</tt></td>
+ <td>API key is disabled</td>
+ </tr>
+ <tr>
+ <td><tt>403</tt></td>
+ <td><tt>1015</tt></td>
+ <td><tt>No</tt></td>
+ <td><tt>ApiUser</tt> must be supplied, or the provided key does not have access to the supplied user</td>
+ </tr>
+ <tr>
+ <td><tt>401</tt></td>
+ <td><tt>1020</tt></td>
+ <td><tt>Yes</tt></td>
+ <td>Session token has expired</td>
+ </tr>
+ <tr>
+ <td><tt>403</tt></td>
+ <td><tt>1030</tt></td>
+ <td><tt>No</tt></td>
+ <td>SSL required for this type of request</td>
+ </tr>
+ <tr>
+ <td><tt>400</tt></td>
+ <td><tt>1035</tt></td>
+ <td><tt>No</tt></td>
+ <td>POST data not supplied as valid JSON. Issued if the <tt>Content-Type</tt> header is not <tt>application/json/</tt> and/or if the POST data is not in valid JSON format.</td>
+ </tr>
+ <tr>
+ <td><tt>400</tt></td>
+ <td><tt>1040</tt></td>
+ <td><tt>No</tt></td>
+ <td>The <tt>_filter</tt> syntax was invalid or a specified field to search on does not exist</td>
+ </tr>
+ <tr>
+ <td><tt>400</tt></td>
+ <td><tt>1050</tt></td>
+ <td><tt>No</tt></td>
+ <td>(message varies) A required parameter was not provided</td>
+ </tr>
+ <tr>
+ <td><tt>400</tt></td>
+ <td><tt>1053</tt></td>
+ <td><tt>No</tt></td>
+ <td>(message varies) A parameter was provided but does not adhere to constraints</td>
+ </tr>
+ <tr>
+ <td><tt>409</tt></td>
+ <td><tt>1055</tt></td>
+ <td><tt>No</tt></td>
+ <td>(message varies)Issued when a write is requested that will conflict with existing data. For example, adding a new contact with an e-mail that already exists.</td>
+ </tr>
+ <tr>
+ <td><tt>403</tt></td>
+ <td><tt>1500</tt></td>
+ <td><tt>No</tt></td>
+ <td>The resource is not available at the current API key's service level. For example, this error applies if a user attempts to access the IDX Links API via a free API key. </td>
+ </tr>
+ <tr>
+ <td><tt>503</tt></td>
+ <td><tt>1550</tt></td>
+ <td><tt>No</tt></td>
+ <td>Over rate limit</td>
+ </tbody>
+</table>
+
+
+
View
2 examples.php
@@ -3,7 +3,7 @@
require_once("flexmlsAPI.php");
// set up the initial connection with our API key and secret
-$api = new flexmlsAPI("idx_demo_key", "TopSecret");
+$api = new flexmlsAPI("api_key_goes_here", "api_secret_goes_here");
// set an ApplicationName which identifies us
$api->SetApplicationName("PHPAPIExamples/1.0");
View
6 flexmlsAPI.php
@@ -5,15 +5,15 @@ class flexmlsAPI {
private $api_base = "api.flexmls.com";
public $last_error_code = null;
public $last_error_mess = null;
- public $last_count = null;
+ public $last_count = 0;
public $api_roles = null;
private $last_token = null;
private $last_token_expire = null;
private $api_key = null;
private $api_secret = null;
private $ch = null;
private $debug_log;
- private $debug_mode = true;
+ private $debug_mode = false;
private $application_name = null;
private $api_version = "v1";
@@ -375,7 +375,7 @@ function MakeAPIRequest($method, $uri, $args = array(), $data = array(), $is_aut
$request_headers .= "User-Agent: flexmls API PHP Client/0.1\r\n";
if (!empty($this->application_name)) {
- $request_headers .= "flexmlsApi-User-Agent: {$this->application_name}\r\n";
+ $request_headers .= "X-flexmlsApi-User-Agent: {$this->application_name}\r\n";
}
curl_setopt($this->ch, CURLOPT_HTTPHEADER, array(trim($request_headers)));

0 comments on commit ae83b03

Please sign in to comment.
Something went wrong with that request. Please try again.