Locations

Locations are the tree everything else hangs from: devices sit in them, episodes can be keyed by them, and reports are grouped by them. Three levels, one parent link, and an external_id you choose.

The location model

Properties

  • Name
    external_id
    Type
    string
    Description

    Required. Your identifier for this place. It is the upsert key — sending the same one twice updates rather than duplicates.

  • Name
    kind
    Type
    string
    Description

    Required. site, zone or point — the three levels of the hierarchy, from the broadest to the most precise.

  • Name
    name
    Type
    string
    Description

    Required. The human-readable name, the one that shows up in the console and in reports.

  • Name
    parent
    Type
    string
    Description

    Optional. The external_id of the parent location. Omit it for a site; provide it for everything below.


POST/v1/locations

Upsert locations

Bulk upsert of the location tree, keyed on external_id within the source, up to 500 per call.

Required attributes

  • Name
    locations
    Type
    array
    Description

    Up to 500 locations.

Headers

  • Name
    Authorization
    Type
    string
    Description

    Bearer <api_key>.

Rejection codes

  • Name
    unknown_parent_location
    Type
    code
    Description

    The parent is neither in the batch nor already declared in this source.

Request

POST
/v1/locations
curl https://api.sinio.ai/v1/locations \
  -H "Authorization: Bearer $SINIO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "locations": [
      { "external_id": "SITE-A", "kind": "site", "name": "Site A" },
      { "external_id": "SITE-A.HALL", "kind": "zone", "name": "Hall",
        "parent": "SITE-A" },
      { "external_id": "SITE-A.HALL.DOOR1", "kind": "point",
        "name": "Main door", "parent": "SITE-A.HALL" }
    ]
  }'

Response

{
  "accepted": 3,
  "rejected": 0,
  "rejections": []
}

Was this page helpful?