Common Behaviors

From API Documentation

Revision as of 19:57, 11 July 2010 by WikiSysop (Talk | contribs)
Jump to: navigation, search

Contents

Access Permissions

Accessing the API requires a username and password, provided by Rezora. To obtain a username and password, contact your Rezora Account Manager.

There are two distinct levels of access to the API, which correspond to user types on the Rezora system in general:

  • Company-level
  • Agent-level

URI (Uniform Resource Identifier)

The Rezora REST API uses the URI to identify the resource you are attempting to consume.

URI Template: PROTOCOL://DOMAIN/VERSION/RESOURCE_DESIGNATOR.RESPONSE_FORMAT
Example URI: http://api.rezora.com/v1/agents/1234.xml

The URI consists of the following components:

Protocol (required)

The API currently supports the basic HTTP protocol, but will likely switch to HTTPS in future versions to further ensure security.

Example URI: http://api.rezora.com/v1/agents/1234.xml

Domain (required)

The domain of the API is expected to be permanent, and will not change with future versions.

Example URI: http://api.rezora.com/v1/agents/1234.xml

Version (required)

The URI for the API includes a version indicator, used to specify the version of the API for which your application is programmed. This will allow us to continue to offer previous versions of the API without interruption as future versions are released.

Example URI: http://api.rezora.com/v1/agents/1234.xml

Resource Designator (required)

The resource designator portion of the URI is the part which uniquely identifies the resource you wish to consume. It may be comprised of multiple components separated by forward slashes (/). For example, to reference the resource containing all agents in your brokerage, your resource designator would be "agents". To reference the resource for a specific agent, you would include the agent's ID in the resource designator: "agents/1234".

Example URI: http://api.rezora.com/v1/agents/1234.xml

Response Format (optional)

The response format indicator is an optional file extension added to the end of the resource designator (described above). Supported values are JSON, XML, and TXT. A response format indicator included in the URI will supersede the value of an ACCEPT header (described below), if present. If no response format indicator is included in the URI, and no ACCEPT header (described below) is included with the request, the response format will default to plain text.

Example URI: http://api.rezora.com/v1/agents/1234.xml

HTTP Request Headers

The Rezora REST API makes use of several headers sent with the HTTP request for such purposes as authentication, indicating what action is to be taken with the resource specified in the URI, and indicating in what format the data will take in both the request and response.

Example Request: 
GET /v1/agents/1234.xml HTTP/1.1
Host: api.rezora.com
Content-type: application/json

The API makes use of the following headers:

Method (required)

The Rezora REST API makes use of the standard HTTP methods (GET, POST, PUT, and DELETE) to determine the action you wish to perform with the resource you have specified in the URI. Note that not all resources will support all four methods. The actions associated with each method are as follows:

GET

A request sent using the HTTP GET method is used to retrieve or read the data for the specified resource.

POST

A request sent using the HTTP POST method is used to create a new resource of the type specified in the URI.

PUT

A request sent using the HTTP PUT method is used to update an existing resource, as specified in the URI.

DELETE

A request sent using the HTTP DELETE method is used to delete the resource indicated in the URI.

Authorization (required)

The Rezora REST API uses HTTP digest access authentication to validate you username and password before providing access to the requested resource.

Accept (optional)

The HTTP ACCEPT header is used to specify the desired format of the response data from the API. The available options are application/xml, application/xml, and text/plain. This option is overridden by the presence of a response format indicator (file extension; see above) in the URI. If no HTTP ACCEPT header or URI response format indicator are present, the default response format will be text/plain.

Content-type (optional)

The HTTP CONTENT-TYPE header is used to specify the format of data being sent as part of the request. The available options are application/xml, application/xml, and text/plain. If no HTTP CONTENT-TYPE header is present, the default request format is assumed to be text/plain.

HTTP Response Headers

Status

Status Codes

  • 200: The request was successfully processed.
  • 204: The request was formatted correctly, but no data was found for the specified resource.
  • 401: Either your username or password are incorrect, or you are attempting to access a resource that is not available for your user type.
  • 404: The resource you have requested does not exist.
  • 405:
  • 500:
  • 501:

Content-type

The HTTP CONTENT-TYPE header is used to indicate the format of data being sent as part of the response. The format is determined by either the ACCEPT HTTP request header or the response format indicator in the request URI. If no HTTP ACCEPT header or URI format indicator are present in the request, the default response format is text/plain.

Personal tools