Common Behaviors
From API Documentation
(→URI (Uniform Resource Identifier)) |
|||
Line 11: | Line 11: | ||
The API currently supports the basic HTTP protocol, but will likely switch to HTTPS in future versions to further ensure security. | The API currently supports the basic HTTP protocol, but will likely switch to HTTPS in future versions to further ensure security. | ||
- | '''''Example URI:''''' | + | '''''Example URI:''''' '''http'''<nowiki>://api.rezora.com/v1/agents/1234.xml</nowiki> |
=== Domain (required) === | === Domain (required) === | ||
Line 17: | Line 17: | ||
The domain of the API is expected to be permanent, and will not change with future versions. | The domain of the API is expected to be permanent, and will not change with future versions. | ||
- | '''''Example URI:''''' <nowiki>http://'''api.rezora.com'''/v1/agents/1234.xml | + | '''''Example URI:''''' <nowiki>http://</nowiki>'''api.rezora.com'''/v1/agents/1234.xml |
=== Version (required) === | === Version (required) === |
Revision as of 06:27, 10 July 2010
Contents |
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.