Ubidots Community

Creating a device with specific properties- through API

I am using the below API to create a device under certain device_Type


However I am unable to realize the proper syntax to assign values to device properties that are defined in the device_Type.

below is the payload I am using while creating the device through above API, where “deviceroom” is one of the property I wish to set.

"enabled": true,
"parent": {
"name": "string"
"name": "device7",
"context": {

"deviceroom": "room-1",

Bumping up the post. I dont necessarily need an answer from Mods/experts but if you have a clue of how above is done please let us know.

@Team, appreciate your inputs ASAP though, as we need to deliver this solution to the client for a COVID related urgency.

Hi there, device types have fixed properties and you cannot dinamycally assign new properties to them. The way to add new properties to a device is to use a PATCH request, please find below the structure to do that using a curl command:

curl 'https://industrial.ubidots.com/api/v1.6/datasources/<DEVICE_ID> \
  -X 'PATCH' \
  -H 'X-Auth-Token: <ACCOUNT_TOKEN>' \
  -H 'Content-Type: application/json' \
  --data-binary '{"context":{"<PROPERTY-1>":<VALUE>,"<PROPERTY-2>":<VALUE>,"_device_type":"<DEVICE_TYPE_LABEL>", "_config":{"<PROPERTY-1>":{"text":"<PROPERTY-1-NAME>","type":"number","description":""},"<PROPERTY-2>":{"text":"<PROPERTY-2-NAME"","type":"number"}}}}' 

You will need to set the property type inside the _config key, properties may be number, text, list, bool or date type.

All the best