View as Markdown

Devices

A Device represents a piece of hardware or a data source that reports readings to the platform. The Devices API lists, creates, updates and deletes the Devices in an organization.

List Devices

GET https://api.controlcomtech.com/primary/v1/<organizationId>/devices

Returns the organization's Devices, newest first. Archived Devices are excluded. Reading requires valid credentials but no specific permission.

  • Name
    search
    Type
    string
    Description

    Case-insensitive filter on the Device name.

  • Name
    type
    Type
    string
    Description

    One or more Device types, comma-separated. Types: CONTROLCOM_GATEWAY, CUSTOM_DEVICE, LORAWAN_GATEWAY_CLOUD, LORAWAN_GATEWAY_EDGE, LORAWAN_DEVICE.

  • Name
    parentDeviceId
    Type
    string
    Description

    Return only the children of this Device.

  • Name
    skip
    Type
    integer
    Description

    Records to skip. See Pagination.

  • Name
    take
    Type
    integer
    Description

    Records to return per page.

curl 'https://api.controlcomtech.com/primary/v1/<organizationId>/devices?take=25' \
--header 'Authorization: Basic <Base64 encoded key ID and secret>'

Retrieve a Device

GET https://api.controlcomtech.com/primary/v1/<organizationId>/devices/<deviceId>

Returns a single Device by id.

Create a Device

POST https://api.controlcomtech.com/primary/v1/<organizationId>/devices

Requires the CreateDevice permission. The body is discriminated by type; every type accepts the common fields, and the LoRaWAN types add a configuration object.

  • Name
    type
    Type
    string
    Description

    Required. One of CONTROLCOM_GATEWAY, CUSTOM_DEVICE, LORAWAN_GATEWAY_CLOUD, LORAWAN_GATEWAY_EDGE, LORAWAN_DEVICE.

  • Name
    name
    Type
    string
    Description

    Required, 5 to 100 characters.

  • Name
    description
    Type
    string
    Description

    Optional, up to 500 characters.

  • Name
    locationId
    Type
    string | null
    Description

    Optional. The Location where the device is installed.

  • Name
    configuration
    Type
    object
    Description

    LoRaWAN types only. Gateways take gatewayEui (16 hex characters) and rfRegion; a US915 region also requires subBand (1 to 8). LoRaWAN devices take devEui, appEui (16 hex characters each) and appKey (32 hex characters).

curl -X POST 'https://api.controlcomtech.com/primary/v1/<organizationId>/devices' \
--header 'Authorization: Basic <Base64 encoded key ID and secret>' \
--header 'Content-Type: application/json' \
--data '{
  "type": "CUSTOM_DEVICE",
  "name": "Chiller Plant Meter",
  "description": "Power meter on the chiller plant feed"
}'

Update a Device

PATCH https://api.controlcomtech.com/primary/v1/<organizationId>/devices/<deviceId>

Requires the UpdateDevice permission. type must always be included, since it selects the validation rules; name, description and locationId are the updatable fields.

Delete a Device

DELETE https://api.controlcomtech.com/primary/v1/<organizationId>/devices/<deviceId>

Requires the DeleteDevice permission. Returns 204 No Content on success. Deleting a Device also removes its Variables and everything that depends on them, so treat this as destructive.

Was this page helpful?