LOCATIONS
The Locations API is used to manage sites. Use the Locations API to:
- Get all sites
- Get a single site
- Add a new site
- Update an existing site
- Delete a site
Note: The following terminology has changed.
| Current Term | Former Term | Definition |
|---|---|---|
| Area | Sublocation | A section of a site that has its own floor plan. For example, each floor of a multi-story building can be defined as an area. A site might have one or more areas. |
| Site | Location | A space that has RTLS coverage, for example, a building or a campus. A server might service one or more sites. A project might include one or more sites. |
HTTP Headers
The HTTP headers used to access all RTLS APIs are listed below. Before submitting requests to the Locations API, set the following headers.
| Header Name | Example Value | Description |
|---|---|---|
| X-User-Email | admin@example.com | Email of the user performing HTTP requests to the API. |
| X-User-Token | Drv3yU7PdyqUMtr89erZ | Token allowing user access to the API. |
| X-User-Project | OfOgUA4kTs2HrmYYlFw6Jg | Project identifier. Value of the project.uid field. |
Set header X-USER-EMAIL
Send a request to log in using POST api/auth/log_in.json described in the Auth API. Using the email address returned in the response, set:
X-USER-EMAIL = data.email
Set header X-USER-TOKEN
Send a request to log in using POST api/auth/log_in.json described in the Auth API. Using the authentication token returned in the response, set:
X-USER-TOKEN = data.token
Set header X-USER-PROJECT
Send a request to get projects using GET api/projects/ described in the Projects API. You must send this request with headers X-USER-EMAIL and X-USER-TOKEN already set. Using the project UID returned in the response, set:
X-USER-PROJECT = projects[i].uid
Locations Endpoints
| Functionality | Method | Endpoint |
|---|---|---|
| get sites | GET | api/locations/ |
| get single site | GET | api/locations/{uid} |
| add site | POST | api/locations/ |
| update site | PUT | api/locations/{uid} |
| delete site | DELETE | api/locations/{uid} |
Endpoints
Get sites
GET api/locations/
Gets all sites.
Response Fields
| Field | Description |
|---|---|
| project_uid | The unique identifier of the project where the site was created. |
| name | The unique name of the site. |
| description | The description of the site. |
| latitude | The geolocation latitude. |
| longitude | The geolocation longitude. |
| elevation | The elevation of a given site, in meters. |
| street_address | The street address of the site. |
| street_address2 | The second line of the street address of the site. |
| city | The city name of the site. |
| state | The state name of the site address. |
| zip | The ZIP code of the site address. |
| zip4 | The ZIP+4 of the site address. |
| created_at | The time stamp of when the site was created, in UTC. |
| updated_at | The time stamp of when the site was last updated, in UTC. |
| orientation | The angle between true north and the coordinate system of the site. |
| uid | The unique identifier for the site. |
| country | The country associated with the site address. |
| user_params | User-defined parameters for the site. |
| user_params.notifications | Use this field to subscribe project system administrator users to receive email or SMS notifications for system events. System events include WIN outages and server issues. |
| user_params.notifications.name | The name of the user to receive system notifications. |
| user_params.notifications.email | The email address of the user to receive system notifications. |
| shift | The list of shift plans for a site. |
| shift.name | The name of a shift. |
| shift.start | The start time of the shift, cron string. |
| shift.end | The end time of the shift, cron string. |
| shift.active | The flag which is indicates the shift activity. |
| shift.expected_others | The number of expected trackables for a shift. |
| shift.expected_vehicles | The number of expected vehicles for a shift. |
| shift.expected_person | The number of expected workers for a shift. |
Example Response
{
"locations": [
{
"project_uid": "PoJZIg8BDJPESRY9VDmv3Q",
"name": "Project 1",
"description": null,
"latitude": null,
"longitude": null,
"elevation": 0,
"street_address": null,
"street_address2": null,
"city": null,
"state": null,
"zip": null,
"zip4": null,
"created_at": "2018-03-04T11:13:24.000Z",
"updated_at": "2018-04-24T20:53:29.000Z",
"orientation": 0,
"uid": "kYv1hIAo9GfFzpiXuXLsax",
"country": "",
"user_params": {
"notifications": []
},
"shift": [
{
"name": "Morning",
"start": "0 7 * * 1,2,3,4,5",
"end": "0 15 * * 1,2,3,4,5",
"active": true,
"expected_others": 10,
"expected_vehicles": 10,
"expected_person": 10
},
{
"name": "Day",
"start": "0 15 * * 1,2,3,4,5",
"end": "0 23 * * 1,2,3,4,5",
"active": true,
"expected_others": 10,
"expected_vehicles": 10,
"expected_person": 10
},
{
"name": "Night",
"start": "0 23 * * 2,3,4,5,6",
"end": "0 7 * * 2,3,4,5,6",
"active": true,
"expected_others": 10,
"expected_vehicles": 10,
"expected_person": 10
}
]
},
{
"project_uid": "PoJZIg8BDJPESRY9VDmv3Q",
"name": "Project 2",
"description": null,
"latitude": 42.21,
"longitude": -71.3,
"elevation": 0,
"street_address": "",
"street_address2": "",
"city": "",
"state": "",
"zip": "",
"zip4": null,
"created_at": "2017-10-13T19:46:48.000Z",
"updated_at": "2018-04-24T20:53:29.000Z",
"orientation": 0,
"uid": "Z4chhOPQIFkkqeINYpZGBN",
"country": "",
"user_params": {
"notifications": []
},
"shift": []
}
]
}
Get single site
GET api/locations/{uid}
Get a site with a specified site UID. To retrieve a site UID, see get sites.
Response Fields
| Field | Description |
|---|---|
| project_uid | The unique identifier of the project where the site was created. |
| name | The unique name of the site. |
| description | The description of the site. |
| latitude | The geolocation latitude. |
| longitude | The geolocation longitude. |
| elevation | The elevation of a given site, in meters. |
| street_address | The street address of the site. |
| street_address2 | The second line of the street address of the site. |
| city | The city name of the site. |
| state | The state name of the site address. |
| zip | The ZIP code of the site address. |
| zip4 | The ZIP+4 of the site address. |
| created_at | The time stamp of when the site was created, in UTC. |
| updated_at | The time stamp of when the site was last updated, in UTC. |
| orientation | The angle between true north and the coordinate system of the site. |
| uid | The unique identifier for the site. |
| country | The country associated with the site address. |
| user_params | User-defined parameters for the site. |
| user_params.notifications | Use this field to subscribe project system administrator users who will receive email or SMS notifications for system events. System events include WIN outages and server issues. |
| user_params.notifications.name | The name of the user who will receive system notifications. |
| user_params.notifications.email | The email address of the user who will receive system notifications. |
| shift | The list of shift plans for a site. |
| shift.name | The name of a shift. |
| shift.start | The start time of the shift, cron string. |
| shift.end | The end time of the shift, cron string. |
| shift.active | The flag which is indicates the shift activity. |
| shift.expected_others | The number of expected trackables for a shift. |
| shift.expected_vehicles | The number of expected vehicles for a shift. |
| shift.expected_person | The number of expected workers for a shift. |
Example Response
Using GET api/locations/Z4chhOPQIFkkqeINYpZGBN:
{
"locations": [
{
"project_uid": "PoJZIg8BDJPESRY9VDmv3Q",
"name": "Project 2",
"description": null,
"latitude": 42.21,
"longitude": -71.3,
"elevation": 0,
"street_address": "100 N Washington St.",
"street_address2": "",
"city": "Boston",
"state": "MA",
"zip": 2114,
"zip4": null,
"created_at": "2017-10-13T19:46:48.000Z",
"updated_at": "2018-04-24T20:53:29.000Z",
"orientation": 0,
"uid": "Z4chhOPQIFkkqeINYpZGBN",
"country": "",
"user_params": {
"notifications": []
},
"shift": [
{
"name": "Morning",
"start": "0 7 * * 1,2,3,4,5",
"end": "0 15 * * 1,2,3,4,5",
"active": true,
"expected_others": 10,
"expected_vehicles": 10,
"expected_person": 10
},
{
"name": "Day",
"start": "0 15 * * 1,2,3,4,5",
"end": "0 23 * * 1,2,3,4,5",
"active": true,
"expected_others": 10,
"expected_vehicles": 10,
"expected_person": 10
},
{
"name": "Night",
"start": "0 23 * * 2,3,4,5,6",
"end": "0 7 * * 2,3,4,5,6",
"active": true,
"expected_others": 10,
"expected_vehicles": 10,
"expected_person": 10
}
]
}
]
}
Example Response
When you send a request with a site UID that does not exist, it returns an empty array:
{
"locations": []
}
Add site
POST api/locations
Add a new site.
Request Fields
| Field | Required? | Type | Description |
|---|---|---|---|
| name | required | string(255) | The name of the site. |
| description | optional | string(255) | The description of the site. |
| latitude | optional | number | The latitude coordinate of the site. |
| longitude | optional | number | The longitude coordinate of the site. |
| elevation | optional | number | The elevation of the site. |
| street_address | optional | string(255) | The street address of the site. |
| street_address2 | optional | string(255) | The second line of the street address of the site. |
| city | optional | string(255) | The city of the site. |
| state | optional | string(255) | The state of the site address. |
| zip | optional | number | The ZIP code of the site address. |
| zip4 | optional | number | The ZIP+4 of the site address. |
| orientation | optional | number | The angle between true north and the coordinate system of the site. |
| country | optional | string(255) | The country associated with the site address. |
| user_params | - | object | User-defined parameters for the site. |
| user_params.notifications | - | array | Use this field to subscribe project system administrator users who will receive email or SMS notifications for system events. System events include WIN outages and server issues. Note: If no system-type notification exists for the project, the system ignores the notification configuration here. For more information on creating a system-type notification, see Notifications API. |
| user_params.notifications.name | optional | string | The name of the user who will receive system notifications. |
| user_params.notifications.email | optional | string | The email address of the user who will receive system notifications. |
Response fields
| Field | Description |
|---|---|
| name | The name of the site. |
| description | The description of the site. |
| latitude | The latitude coordinate of the site. |
| longitude | The longitude coordinate of the site. |
| elevation | The elevation of the site, in meters. |
| street_address | The street address of the site. |
| street_address2 | The street address of the site. |
| city | The city of the site. |
| state | The state of the site. |
| zip | The ZIP code of the site. |
| zip4 | The ZIP +4 of the site. |
| created_at | The UTC time stamp when the site was created. |
| updated_at | The UTC time stamp when the site was last updated. |
| orientation | The angle between true north and the coordinate system of the site. |
| uid | The unique identifier for the site. |
| country | The country where the site is located. |
| user_params | User-defined parameters for the site. |
| user_params.notifications | Use this field to subscribe project system administrator users who will receive email or SMS notifications for system events. System events include WIN outages and server issues. |
| user_params.notifications.name | The name of the user who will receive system notifications. |
| user_params.notifications.email | The email address of the user who will receive system notifications. |
| shift | The list of shift plans for a site. |
| project_uid | The unique identifier of the project where the site was created. |
Example Request
{
"name": "Test",
"description": "",
"latitude": 0,
"longitude": 0,
"elevation": 0,
"street_address": "",
"street_address2": null,
"city": "",
"state": "",
"zip": "",
"zip4": null,
"orientation": 0,
"user_params": {
"notifications": [ {
"name": "User1",
"email": "user@example.com"
} ]
}
}
Example Response
{
"name": "Test",
"description": "",
"latitude": 0,
"longitude": 0,
"elevation": 0,
"street_address": "",
"street_address2": null,
"city": "",
"state": "",
"zip": 0,
"zip4": null,
"created_at": "2018-05-10T18:06:00.000Z",
"updated_at": "2018-05-10T18:06:00.000Z",
"orientation": 0,
"uid": "Z4chhOPQIFkkqeINYpZGBN",
"country": "",
"project_uid": "xwacfMumRVejZlhnZhNrKw",
"user_params": {
"notifications": [ {
"name": "User1",
"email": "user@example.com"
} ]
},
"shift": []
}
Errors
| Error Status | Error Type | Error Body | Description |
|---|---|---|---|
| 400 | Bad request | {"status":400,"message":"Unexpected token , in JSON at position","name":"SyntaxError","type":"entity.parse.failed"} | Unexpected string in JSON. |
| 422 | Validation error | {"name":"ValidationError", "details": [{"message":'"name" is required'}]} | Required fields are missing. |
Update site
PUT api/locations/{uid}
Edit a site with a specified site UID. To retrieve a site UID, see get sites.
Request Fields
| Field | Required? | Type | Description |
|---|---|---|---|
| name | required | string(255) | The name of the site. |
| description | optional | string(255) | The description of the site. |
| latitude | optional | number | The latitude coordinate of the site. |
| longitude | optional | number | The longitude coordinate of the site. |
| elevation | optional | number | The elevation of the site, in meters. |
| street_address | optional | string(255) | The street address of the site. |
| street_address2 | optional | string(255) | The street address of the site. |
| city | optional | string(255) | The city of the site. |
| country | optional | string(255) | The country of the site. |
| state | optional | string(255) | The state of the site. |
| zip | optional | number | The ZIP code of the site. |
| zip4 | optional | number | The ZIP+4 of the site. |
| orientation | optional | number | The angle between true north and the coordinate system of the site. |
| country | optional | string(255) | The country associated with the site address. |
| user_params | - | object | User-defined parameters for the site. |
| user_params.notifications | - | array | Use this field to subscribe project system administrator users who will receive email or SMS notifications for system events. System events include WIN outages and server issues. Note: If no system-type notification exists for the project, the system ignores the notification configuration here. For more information on creating a system-type notification, see Notifications API. |
| user_params.notifications.name | optional | string | The name of the user who will receive system notifications. |
| user_params.notifications.email | optional | string | The email address of the user who will receive system notifications. |
| shift | required | array | The list of shift plans for a site. |
| shift.name | required | string | The name of a shift. |
| shift.start | required | string | The start time of the shift, cron string. |
| shift.end | required | string | The end time of the shift, cron string. |
| shift.active | optional | boolean | The flag which is indicates the shift activity. |
| shift.expected_others | optional | number | The number of expected trackables for a shift. |
| shift.expected_vehicles | optional | number | The number of expected vehicles for a shift. |
| shift.expected_person | optional | number | The number of expected workers for a shift. |
Response fields
| Field | Description |
|---|---|
| name | The name of the site. |
| description | The description of the site. |
| latitude | The latitude coordinate of the site. |
| longitude | The longitude coordinate of the site. |
| elevation | The elevation of the site, in meters. |
| street_address | The street address of the site. |
| street_address2 | The street address of the site. |
| city | The city of the site. |
| country | The country of the site. |
| state | The state of the site. |
| zip | The ZIP code of the site. |
| zip4 | The ZIP +4 of the site. |
| created_at | The time stamp of when the site was created, in UTC. |
| updated_at | The time stamp of when the site was last updated, in UTC. |
| orientation | The angle between true north and the coordinate system of the site. |
| uid | The unique identifier for the site. |
| country | The country associated with the site address. |
| user_params | User-defined parameters for the site. |
| user_params.notifications | Use this field to subscribe project system administrator users who will receive email or SMS notifications for system events. System events include WIN outages and server issues. |
| user_params.notifications.name | The name of the user who will receive system notifications. |
| user_params.notifications.email | The email address of the user who will receive system notifications. |
| shift | The list of shift plans for a site. |
| shift.name | The name of a shift. |
| shift.start | The start time of the shift, cron string. |
| shift.end | The end time of the shift, cron string. |
| shift.active | The flag which is indicates the shift activity. |
| shift.expected_others | The number of expected trackables for a shift. |
| shift.expected_vehicles | The number of expected vehicles for a shift. |
| shift.expected_person | The number of expected workers for a shift. |
| project_uid | The unique identifier of the project where the site was created. |
Example Request
Using PUT api/locations/bchvqNR1Qwbmywgglpm0hL:
{
"name": "Test site",
"description": "",
"latitude": 0,
"longitude": 0,
"elevation": 0,
"street_address": "",
"street_address2": null,
"city": "Chicago",
"state": "",
"zip": 2114,
"zip4": null,
"orientation": 0,
"country": "",
"user_params": {
"notifications": []
},
"shift": [
{
"name": "Morning",
"start": "0 7 * * 1,2,3,4,5",
"end": "0 15 * * 1,2,3,4,5",
"active": true,
"expected_others": 10,
"expected_vehicles": 10,
"expected_person": 10
},
{
"name": "Day",
"start": "0 15 * * 1,2,3,4,5",
"end": "0 23 * * 1,2,3,4,5",
"active": true,
"expected_others": 10,
"expected_vehicles": 10,
"expected_person": 10
}
]
}
Example Response
{
"name": "Test site",
"description": "",
"latitude": 0,
"longitude": 0,
"elevation": 0,
"street_address": "",
"street_address2": null,
"city": "Chicago",
"state": "",
"zip": 2114,
"zip4": null,
"created_at": "2018-05-10T18:06:00.000Z",
"updated_at": "2018-05-10T18:42:49.000Z",
"orientation": 0,
"uid": "bchvqNR1Qwbmywgglpm0hL",
"country": "",
"user_params": {
"notifications": []
},
"project_uid": "xwacfMumRVejZlhnZhNrKw",
"shift": [
{
"name": "Morning",
"start": "0 7 * * 1,2,3,4,5",
"end": "0 15 * * 1,2,3,4,5",
"active": true,
"expected_others": 10,
"expected_vehicles": 10,
"expected_person": 10
},
{
"name": "Day",
"start": "0 15 * * 1,2,3,4,5",
"end": "0 23 * * 1,2,3,4,5",
"active": true,
"expected_others": 10,
"expected_vehicles": 10,
"expected_person": 10
}
]
}
Errors
| Error Status | Error Type | Error Body | Description |
|---|---|---|---|
| 404 | Not Found | {"message":"Location '${uid}' not found"} | A site with the specified UID was not found. |
| 422 | Unprocessable Entity | "message":"child \"name\" fails because [\"name\" is not allowed to be empty]" | The required field for site name was left empty. |
Delete site
DELETE api/locations/{uid}
Delete a site with a specified site UID. To retrieve a site UID, see get sites.
Returns status 200 for all results.