The Basics
The api is RESTful, this means HTTP verbs and response codes are meaningful, and request headers (language, format etc) are respected.
HTTP verb usage:
- GET to retrieve data
- POST to add/update data
- DELETE to delete data
Response codes
- 200 - OK
- 400 - Request missing neccessary parameters
- 403 - Unauthorized
- 404 - Resource not found
Authentication
Authentication is done using an api key.
Api Credentials can be generated from your ScubaTribe account under connect->api.
Pass the api Key value as the header parameter API-KEY
(this parameter can also be sent in the querystring, though this is discouraged for production use)
An Invalid key would return:
{ "status": "error", "error": "Invalid Key." }
Keys can also be disabled via the ScubaTribe account, and this should be handled by your application.
Inactive key returns the following error:
{ "status": "error", "error": "Invalid Key." }
Output Formats
The default format is JSON, there are several ways to request a different response format:
1) Send the appropriate HTTP Accept header (recommended)
2) send the query parameter 'format' e.g. ?format=json
3) request the resource with the appropriate extension e.g. requests/code.json
- 'xml' => 'application/xml'
- 'json' => 'application/json',
- 'jsonp' => 'application/javascript'
- 'jsonp' => 'application/javascript'
- 'serialized' => 'application/vnd.php.serialized'