SUBLOCATIONS

The Sublocations API is used to manage areas. Use the Sublocations API to:

  • Get all areas from the server
  • Get a single area using a UID
  • Create an area
  • Edit an area
  • Delete an area

Note: The following terminology has changed:

Current Term Former Term Definition
Area Sublocation A section of a site that has its own floorplan. For example, each floor of a multi-story building can be defined as an area.
Site Location A space that has RTLS coverage. For example, a building or a campus. A server might service one or more sites.

HTTP headers

The HTTP headers used to access all RTLS APIs are listed below. Before submitting requests to the Sublocations 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

Sublocations Endpoints

Functionality Method Endpoint
get area GET api/sublocations
get single area GET api/sublocations/{uid}
create area POST api/sublocations
edit area PUT api/sublocations/{uid}
delete area DELETE api/sublocations/{uid}

Endpoints

Get areas

GET api/sublocations

Get all areas.

Response Fields

Field Description
project_name The project to which the area belongs.
project_uid The unique identifier of the project to which the area belongs.
company_uid The unique identifier of the company to which the area belongs.
id The identifier of the area in the context of the database.
name The user-defined name of the area.
description The user-defined description of the area.
created_at The UTC time stamp of when the area was created.
updated_at The UTC time stamp of when the area was last updated.
offset_x The x-direction offset; the default is 0.
offset_y The y-direction offset; the default is 0.
offset_z The z-direction offset; the default is 0.
uid The unique identifier for the area.
location_uid The unique identifier of the area's parent site.

Example Response

{
    "sublocations": [
        {
            "project_name": "Project 1",
            "project_uid": "4MewVvhLqruxJdudVuPM3y",
            "company_uid": "N0F1hpt7CHtF36rVT6QkrS",
            "id": 1,
            "name": "Area 1",
            "description": "",
            "created_at": "2018-03-04T11:13:24.000Z",
            "updated_at": "2018-04-25T18:37:01.000Z",
            "offset_x": 0,
            "offset_y": 0,
            "offset_z": 0,
            "uid": "y6Yh4pxXgggAL7YZlEslsn",
            "location_uid": "V4SBZaRXR5Ks5IhuR7N5qI"
        },
        {
            "project_name": "Project 1",
            "project_uid": "II4A3V5Tdc44QN0qqd8HDL",
            "company_uid": "PWvZgMvH0LrYllSiw7GFS0",
            "id": 15,
            "name": "Area 2",
            "description": "",
            "created_at": "2018-03-20T19:39:30.000Z",
            "updated_at": "2018-03-20T19:39:30.000Z",
            "offset_x": 0,
            "offset_y": 0,
            "offset_z": 0,
            "uid": "tDMRSS0xTI3txuHKX3TKME",
            "location_uid": "Mrqfux9UqN9coJspAACzIP"
        },

Get single area

GET api/sublocations/{uid}

Get a single area with a specified area UID. To retrieve an area UID, see get area.

Response Fields

Field Description
id The identifier of the area in the context of the database.
name The user-defined name of the area.
description The user-defined description of the area.
created_at The UTC time stamp when the area was created.
updated_at The UTC time stamp when the area was last updated.
offset_x The x-direction offset; the default is 0.
offset_y The y-direction offset; the default is 0.
offset_z The z-direction offset; the default is 0.
uid The unique ID for the area.
location_uid The unique identifier of the parent site.

Example Response

Using GET api/sublocations/Nnm9J7fKRCOLYr4ePE4_lg:

{
    "sublocations": [
        {
            "id": 5,
            "name": "Test subloc1 rename",
            "description": null,
            "created_at": "2017-06-14T09:58:13.000Z",
            "updated_at": "2017-06-14T09:59:58.000Z",
            "offset_x": 0,
            "offset_y": 0,
            "offset_z": 0,
            "uid": "Nnm9J7fKRCOLYr4ePE4_lg",
            "location_uid": "vtzKGtOeQ3eInHFe_Ab2nQ"
        }
    ]
}

Example Response

When the specified UID for the area does not exist, it returns an empty array:

{
    "sublocations": []
}

Create area

POST api/sublocations

Create a new area.

Request Fields

Field Required/Optional Type Description
name required string The user-defined name of the area.
description optional string The user-defined description of the area.
offset_x optional number The x-direction offset; the default is 0.
offset_y optional number The y-direction offset; the default is 0.
offset_z optional number The z-direction offset; the default is 0.
location_uid required string The unique identifier of the area's site parent. To retrieve a site UID, use GET api/locations described in Locations API.

Response Fields

Field Description
id The identifier of the area in the context of the database.
name The name of the area.
description The description of the area.
created_at The time when the area was created.
updated_at The time when the area was updated.
offset_x The x-direction offset; the default is 0.
offset_y The y-direction offset; the default is 0.
offset_z The z-direction offset; the default is 0.
uid The unique identifier for the area.
location_uid The unique identifier of the site parent for the area.

Example Request

{
    "name": "Test subloc1",
    "description": null,
    "offset_x": 0,
    "offset_y": 0,
    "offset_z": 0,
    "location_uid": "vtzKGtOeQ3eInHFe_Ab2nQ"
}

Example Response

{
  "id": 5,
  "name": "Test subloc1",
  "description": null,
  "created_at": "2017-06-14T09:58:13.000Z",
  "updated_at": "2017-06-14T09:58:13.000Z",
  "offset_x": 0,
  "offset_y": 0,
  "offset_z": 0,
  "uid": "Nnm9J7fKRCOLYr4ePE4_lg",
  "location_uid": "vtzKGtOeQ3eInHFe_Ab2nQ"
}

Errors

Error Status Error Type Error Body Description
422 ValidationError {"name":"ValidationError", "details": [{"message":'"name" is required'}]} The request did not include one or more required fields.
404 Not Found {"message":'Location "..." not found'} A site with the specified location_uid field was not found.

Edit area

PUT api/sublocations/{uid}

Edit an area with a specified area UID. To retrieve an area UID, see get areas.

Request Fields

Field Required/Optional Type Description
name optional string The name of the area.
description optional string The description of the area.
offset_x optional number The x-direction offset; the default is 0.
offset_y optional number The y-direction offset; the default is 0.
offset_z optional number The z-direction offset; the default is 0.
location_uid optional string The unique identifier of the site parent for the area. To retrieve a site UID, use GET api/locations described in Locations API.

Response Fields

Field Description
id The identifier of the area in the context of the database.
name The name of the area.
description The description of the area.
created_at The timestamp when the area was created.
updated_at The timestamp for the last time the area was updated.
offset_x The x-direction offset; the default is 0.
offset_y The y-direction offset; the default is 0.
offset_z The z-direction offset; the default is 0.
uid The unique identifier for the area.
location_uid The unique identifier of the site parent for the area.

Example Request

Using PUT api/sublocations/Nnm9J7fKRCOLYr4ePE4_lg:

{
    "name": "Test subloc1 rename",
    "description": "Some city",
    "offset_x": 10,
    "offset_y": 20,
    "offset_z": 30
}

Example Response

{
    "id": 5,
    "name": "Test subloc1 rename",
    "description": "Some city",
    "created_at": "2017-06-14T09:58:13.000Z",
    "updated_at": "2017-06-14T09:59:58.000Z",
    "offset_x": 10,
    "offset_y": 20,
    "offset_z": 30,
    "uid": "Nnm9J7fKRCOLYr4ePE4_lg",
    "location_uid": "vtzKGtOeQ3eInHFe_Ab2nQ"
}

Delete area

DELETE api/sublocations/{uid}

Deletes the area with a specified area UID. To retrieve an area UID, see get area.

Returns a status 200 for all results.

results matching ""

    No results matching ""