Create Device

This endpoint creates a new Device.

Request

To create a new Device please make a POST request to the following URL:

HTTP MethodURL
POSThttps://industrial.api.ubidots.com/api/v2.0/devices/

Query Parameters

ParameterTypeUseDescription
tokenStringAuthenticationAuthentication Token can optionally be sent as a query parameter.

Body Parameters

ParameterTypeRequired?Default ValueDescription
labelStringYesN/A (required)API label of Device
nameStringNoSame as labelName of Device
descriptionStringNo""Description of Device
tagsString ArrayNo[ ]Device tags
propertiesObjectNo{ }Device properties. Allowed attributes: _icon, _color, _location_type, _location_variable (label of Variable), _location_fixed, _config
organizationStringNonullOrganization 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, or auto. More info
_location_variable: Label of the Variable containing the GPS coordinates (for _location_type:specified)
_location_fixed: Object with lat and lng 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

ParameterTypeDescription
X-Auth-TokenStringAuthentication Token of account
Content-TypeString (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.