Create a Thing along with sensor assignment

Create a thing along with sensor assignment

Thing to Sensors Assignment

Prerequisites

Configure the IoT service credentials using Thing Modeler data mapping credentials API. See Create Credentials.

To onboard Thing Type along with its mappings with Sensor Types through convenience services, see Thing Type and Sensor Type Mapping.

Functional Overview

Thing REST service supports auto creation of Device, Sensors, Thing and Assignment in a single API without the need of separate calls to IoT Service APIs.

This will be achieved by the below implementation approach:

  • REST Payload of Thing API now includes device, sensors and assignment object structure.

  • This API will internally perform the following actions to create the artifacts:

    • REST APIs of IoT Services create Devices and Sensors and obtain the object IDs.

    • Creates a Thing.

    • Assigns sensors to the Thing.

Request

URI:/Things

HTTP Method:POST

Permissions:

<thing>.c

Request Properties

Sensor Assignment Properties

Parent Key Property Type Mandatory

Maximum Length

Description
_assignment _mappingId GUID Yes 32

Thing Type to Sensor Type Mapping ID

_devices _name string Yes 81

Name of the IoT Service device

_devices _gatewayName string Yes, if device needs to be newly created 81

Gateway ID of IoT Service

This is immutable and cannot be updated for an existing device. It means if the payload has a device with an ID, then that device should not have the gateway name.

_devices _alternateId string No 81

Alternate ID of IoT Service Device

This is immutable and cannot be updated for an existing device. It means If the payload has a device with an ID, then that device should not have the alternate ID.

_sensors _name string Yes 81

Name of the IoT Service sensor

_sensors _alternateId string No 81 Alternate ID of IoT Service Sensor
_sensors _sensorTypeId string Yes 81

Sensor Type ID of the IoT Service sensor