This endpoint creates a new Device.
Request
To create a new Device please make a POST request to the following URL:
HTTP Method | URL |
---|---|
POST | https://industrial.api.ubidots.com/api/v2.0/devices/ |
Query Parameters
Parameter | Type | Use | Description |
---|---|---|---|
token | String | Authentication | Authentication Token can optionally be sent as a query parameter. |
Body Parameters
Parameter | Type | Required? | Default Value | Description |
---|---|---|---|---|
label | String | Yes | N/A (required) | API label of Device |
name | String | No | Same as label | Name of Device |
description | String | No | "" | Description of Device |
tags | String Array | No | [ ] | Device tags |
properties | Object | No | { } | Device properties. Allowed attributes: _icon , _color , _location_type , _location_variable (label of Variable), _location_fixed , _config |
organization | String | No | null | Organization of Device |
Properties
Attribute Explained
_icon
: Icon of Variable (FontAwesome)
_color
: HEX, RGB and RGBA
_location_type
: Determines the location type, allowed values:manual
,specified
, orauto
. More info
_location_variable
: Label of the Variable containing the GPS coordinates (for_location_type:specified
)
_location_fixed
: Object withlat
andlng
key containing the gps coordinates (for_location_type:manual
)
_config
: Please see below
_config
All the configuration data of each property is saved as an object attribute in the _config key. This configuration contains the type of the property, the friendly name to be displayed in the front-end and the description to be also displayed in the front-end.
_config: { propertyKey: { text: string, // Property Key friendly name type: string: "boolean"|"date"|"list"|"text"|"number", description: string, // Description of the property key options?: array<string>, // This is passed in case the type is list value: string, // Default value } }
Header
Parameter | Type | Description |
---|---|---|
X-Auth-Token | String | Authentication Token of account |
Content-Type | String (application/json) | Content type of body |
curl -X POST 'https://industrial.api.ubidots.com/api/v2.0/devices/' \
-H 'Content-Type: application/json' \
-H 'X-Auth-Token: oaXBo6ODhIjPsusNRPUGIK4d72bc73' \
-d '{"label": "arduino",
"properties": {
"_location_type":"manual",
"_location_fixed": {
"lat": 6.2486,
"lng": 75.5742
}
}
}'
{
"id": "ac5e948a581a9bb541a43feee",
"label": "second-device",
"name": "Second Device",
"description": "other description",
"isActive": true,
"lastActivity": null,
"organization": null,
"position": {},
"tags": ["first"],
"properties": {
"_location_fixed": {
"lat": 6.2486,
"lng": 75.5742
}
},
"url": "http://industrial.ubidots.com/api/v2.0/devices/ac5e948a581a9bb541a43feee",
"variables": "http://industrial.ubidots.com/api/v2.0/devices/ac5e948a581a9bb541a43feee/variables",
"variablesNumber": 0,
"createdAt": "2019-11-25T19:35:08.975270Z"
}
{
"code": 400001,
"message": "Validation Error.",
"detail": {
....
}
}
{
"code": 401001,
"message": "Authentication credentials were not provided.",
"detail": "Authentication credentials were not provided."
}
Response
Returns a Device object of the Device created.