Communication with the 88 Miles API is done via REST via XML or JSON. REST APIs use HTTP request verbs for communication, so you don’t need any special libraries (other than a HTTP library).
In the 88 Miles, each resource has two endpoints, combined with the four HTTP verbs, there are 5 main actions:
|/endpoint||Returns all items (index)||Saves a new item (create)||N/A||N/A|
|/endpoint/id||N/A||Returns a specific item (show)||Updates a specific item (update)||Destroys a specific item (destroy)|
The projects and shifts resources supported nested URLs.
|/companies/1/projects||Returns all the projects that belong to the company with id #1|
|/projects/1/shifts||Returns all the shifts that belong to the project with id #1|
The 88 Miles API is available in XML and JSON. To access the XML version, add .xml at the end of your request; to access the JSON version add .json. See the API documentation for each endpoint to see examples.
Response Codes and Errors
88 Miles will use HTTP response codes where possible to represent errors. Where this isn't practical, an error string will generally be returns as part of the response. These errors are documented within the API documentation
88 Miles uses the following HTTP responses (There may be some other responses, but they will generally be handled by your HTTP library):
|200||Ok||The request was successfull|
|201||Created||A new object has been created|
|403||Access Denied||Either your username and password or OAuth credentials are incorrect|
|404||Not Found||The resource you have requested doesn't exist|
|405||Method Not Allowed||A request was made of a resource using a request method not supported by that resource; for example, using GET on a form which requires data to be presented via POST, or using PUT on a read-only resource.|
|422||Unprocessable Entity||This will be returned if, when creating or updating an object, the data supplied is not valid|
|500||Internal Server Error||A specific error has occured. Check the returned XML or JSON body for information about the error|
The 88 Miles API is compatible with Ruby on Rails ActiveResource, so if you are a ruby user, integration is really easy.