thing.create

The thing.create command creates a new Thing.

TR50 Request (Generic Thing)

{
  "cmd": {
    "command": "thing.create",
    "params": {
      "name": "My New Thing Name",
      "key": "12e692ba0f62g167",
      "defKey": "thingdefinitionkey",
      "desc": "Description of my new thing",
      "iccid": "123456789",
      "esn": "123456789",
      "tunnelActualHost": "192.168.4.241",
      "tunnelVirtualHost": "127.10.10.10",
      "tunnelLatencies": {
        "router01": 110,
        "router02": 340
      },
      "tags": ["tag1", "tag2"],
      "secTags": ["secTag1", "secTag2"],
      "controlTags": ["controlTag1", "controlTag2"],
      "attrs": {
        "attribute1key": {
          "value": "25",
          "ts": "2021-11-05T02:03:04.322Z"
        },
        "attribute2key": {
          "value": "Orange",
          "ts": "2021-11-05T02:03:04.322Z"
        }
      },
      "locEnabled": false
    }
  }
}

TR50 Request (LWM2M/LoRA Thing - First call)

For LWM2M and LoRa device creation, you need to first create the Thing and then create the device (Second call). Below are the sample API calls, for more details on the second call (device creation), see lwm2m.device.create and lora.device.create.

{
  "cmd":{
    "command":"thing.create",
    "params":{
      "name":"fota-thing-5",
      "key":"fota-thing-5",
      "defKey":"default",
      "desc":"fota-thing-5",
      "tags":[
        "FOTA-AUTO"
      ],
      "endpoint":"fota-thing-5",
      "connection":"bootstrap_dtls",
      "identity":"F2ED0CDE4986A6CD7BCB9B760CA14AB3",
      "psk":"3B73DF398CCF940835CB0F6F0B0D32B3",
      "bsIdentity":"device_identity_001",
      "bsPsk":"3B73DF398CCF940835CB0F6F0B0D32B3",
      "profileId":"5a32fa31b5143809c8d938a1"
    }
  }
}

TR50 Request (LWM2M - Second call)

{
  "1":{
    "command":"lwm2m.device.create",
    "params":{
      "endpoint":"lwm2m_client_001",
      "thingId":"<thing_id_from_the_first_call>",
      "connection":"bootstrap_dtls",
      "identity":"device_identity_001",
      "psk":"3B73DF398CCF940835CB0F6F0B0D32B3",
      "bsIdentity":"device_identity_001",
      "bsPsk":"3B73DF398CCF940835CB0F6F0B0D32B3",
      "profileId":"5a32fa31b5143809c8d938a1"
    }
  }
}

TR50 Request (LoRa Thing - Second call)

{
  "1":{
    "command":"lora.device.create",
    "params":{
      "thingId":"<thing_id_from_the_first_call>",
      "deviceEui":"3031323334353637",
      "actType":"otaa",
      "actOtaaAppKey":"0123456789ABCDEF",
      "providerId":"520000000000000000000002",
      "provider":{
        "deviceProfileId":"LORA/GenericA.1",
        "connectivityPlanId":"device/device-trial"
      }
    }
  }
}

Request Parameters

Name Type Required Description
name String Yes The name of the Thing.
key String Yes The key of the Thing.
defKey String Yes* The Thing definition key .
defId String The Thing definition Id.
*One of the above parameters is required to identify the Thing definition.
desc String The textual description of the Thing.
iccid String The iccid of the Thing.
esn String The esn of the Thing.
imei String   The imei of the Thing.
meid String   The meid of the Thing.
imsi String   The imsi of the Thing.
msisdn String   The msisdn of the Thing.
tunnelActualHost String   The actual IP address or hostname that should be used from the Thing's gateway to reach the Thing.
tunnelVirtualHost String   The virtual IP address or hostname that will be used by the tunnel manager to access the tunnels.
tunnelLatencies String:Int Pairs   Mappings of key:value pairs indicating the latency between the Thing and each router. Note, this field will only be used on a directly connected Thing, Things bound to other Things will inherit the tunnelLatencies from their parent Thing.
tags Array   An array of tags associated with the Thing.
secTags Array   An array of security tags associated with the Thing.
controlTags Array   An array of control tags associated with the Thing
attrs Object   Key-value pairs where the key is the key of the attribute and the value is an attribute object.
<attrs-key>.value String This is the value of the attribute.
<attrs-key>.ts Timestamp The timestamp of the attribute.
locEnabled Boolean If the Thing is location enabled.
smsc String The SMSC for sending messages to the Thing via SMS.

For more details on the parameters of the LWM2M and LoRa device creation, see lwm2m.device.create and lora.device.create.

TR50 Response

If the command is sent successfully a success message is returned. Otherwise, an error and error message will be returned.

{
  "cmd": {
    "success": true
  }
}