Creating device locations using the Okappy API
To create a device location for one of your employees using the Okappy API, follow the instructions below
Authentication
First you will need to get an up to date authentication token. For further information see authenticating with Okappy.
Creating a location
Add device locations using the following endpoint. Send the body as a JSON array, even when you are sending one location.
POST /locations
Headers
| Header | Content |
|---|---|
| Authorize | Bearer token |
The token should be a string taken from the “access_token” field of a response to an authorise request.
Parameters
No parameters
Body data
The body data of the request should be sent with content type application/json. It should contain a JSON array with the following basic structure:
The following table lists the fields that may be present in the body data:
| Name | Content | Required |
|---|---|---|
| deviceSimNumber | The SIM number or device identifier | Yes |
| Message | The device location message body in GPRMC format | Yes |
Notes:
- You can provide the connection id and/or customer name of your customer, otherwise the job will default to yourself.
- You can retrieve your connection id using the connections endpoint.
- If the customer name is provided, please ensure it matches your customers name including position of any spaces and spelling. Capitalisation does not matter.
- If both a connection id and customer name is provided, the customer name will take precedence.
Reference: For further information about creating jobs with a template, see https://www.okappy.com/support-article/creating-job-templates/
Response
| Code | Description |
|---|---|
| 200 | Operation successful |
| 204 | No data returned |
| 400 | Bad request |
| 401 | Unauthorised |
| 415 | Data sent in wrong format (should be JSON) |
| 429 | Too many requests in a short period of time (please try again later) |