REST over HTTP
General
The CalAmp Telematics Cloud API is a REST over HTTP implementation. As such, you can make requests to the API via any HTTP client with TLS 1.1 or higher.
This section covers REST basics, as well as CTC-specific items such as the data exchange format, required HTTP headers, and several supported HTTP request parameters.
HTTP Verbs
Verb | Description |
---|---|
GET | To read a resource. |
POST | To create a new resource. |
PUT | To update an existing resource. Requires the full resource to be sent in the request body as it completely replaces the old with the new. |
DELETE | To delete a resource. |
HEAD | Similar to making a GET call on the URL, except it has no response body. |
OPTIONS | To request information about the communication options supported by the API endpoint. |
HTTP Status Codes in Responses
CTC follows the standard HTTP status codes. In general, the meaning of the status codes is as defined by RFC2616, but there might be some semantic differences.
Status | Description |
---|---|
200 | The request completed as expected. In the case of a GET or PUT request, the latest state of the resource acted on is returned in the response body. In the case of a HEAD or OPTIONS request, only the metadata is returned in headers. |
201 | The request to create a new resource completed as expected. The new resource is returned in the response body. |
202 | The request was received, but the task has not completed yet. Usually in response to a request to perform an asynchronous task. |
400 | Bad request. Generally because of missing required parameters or invalid supplied values. |
401 | Not authenticated. |
403 | Forbidden. The authenticated user is not authorized to perform the requested action on the specified resource. |
404 | Either the specified resource or an associated resource was not found. |
405 | The requested action is not supported on the specified resource. |
409 | The resource state is in conflict. Generally in response to a PUT request where the supplied state of the resource is not the latest state in the system. |
417 | The expectations specified in the request could not be fulfilled (for example, in the case of link expansion or some expectation defined in the Expect header). |
422 | The server understands the request content, and valid values are supplied, but it is unable to fulfill the request (for example, "username already exists" constraint). |
500 | The API encountered an unexpected error and cannot complete the request. |
CTC Data Exchange Formats
The API uses JSON as the data exchange format and UTF-8 encoding, for both requests and responses. In order of precedence, the format can be specified via the following:
-
<