Add a Device

Add a device to Milesight Development Platform and associate it with the current Application.

Request URL

POST {base_url}/device/openapi/v1.0/devices

Request parameters

Table 1. Header Parameters
Parameter Required Type Description
Authorization Yes String The valid access token for making API calls.

The format should be Bearer {access_token}.

Table 2. Body Parameters
Parameter Required Type Description
snDevEUI Yes String The SN (serial number) or EUI (Extended Unique Identifier) of the device.
name Yes String Specify a name to help you identify this device.
description No String Enter the device description.
autoProvision No Boolean Whether to enable Auto Provision for this device, which will automatically apply pre-configured settings from a Profile template to this device after addition.
Valid value:
  • false: Disable.
  • true: Enable.
    Note: When this value is set to true, you need to include the configuration profile of the specific device in the profile parameter.
profile No String
Note: This parameter is required when autoProvision is set to true.

The Profile template for Auto Provision, which is presented in JSON format.

  • For Internet inaccessible devices, you can use below TSL configuration template format to assign the configurations:
    {
       "version":"v1.0",   //profile version
       "type": "TSL",
       "properties":{
            "reporting_interval": 600, 
              .......
         }
    }

    The properties content can be referred to Configuration Properties.

project No String Specify a tag to help you identify and categorize devices.

Response parameters

Parameter Type Description
data Object<Device_Info> Information of the added device.
status String The result of the API request.
  • Success
  • Failed
requestId String The unique ID of the request, which can be used to quickly locate the request.
Device_Info
Parameter Type Description
sn String The SN (Serial Number) of this device.
deviceId Integer The unique ID of this device on Milesight Development Platform.
Note: It is recommended to save this deviceID for future use, as it is required for managing or configuring the device through the API.
devEUI String
Note: Depending on the product model, this parameter may NOT be returned.
The EUI (Extended Unique Identifier) of this device.
imei String
Note: Depending on the product model, this parameter may NOT be returned.
The IMEI (International Mobile Equipment Identity) of this device.

Examples

Request example
Add VS121-P to Milesight Development Platform and associate with this Application.
POST /device/openapi/V1.0/devices HTTP/1.1
Host: milesight.demo.com
Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCIsImtpZCI6InllYXN0b25lLWRlZmF1bHQta2V5LWlkIn0.eyJncmFudF90eXBlIjoiY2xpZW50X2NyZWRlbnRpYWxzIiwic2NvcGUiOlsib3BlbmFwaSJdLCJjbGllbnRfZXh0Ijp7ImFwcF9pZCI6IjE3MzY5NTQ4MDE3MTMzMjgxMzAifSwiZXhwIjoxNzAzMjEzMDk4LCJhdXRob3JpdGllcyI6WyJST0xFX0NMSUVOVCJdLCJqdGkiOiJiYjJjN2U4Yy03NGQwLTQ4NjEtODE3MS1iYTc0NWRlMGY0NmQiLCJjbGllbnRfaWQiOiI4OTNkNzdjNy1mMGNiLTRmMzQtOWNhMS03YzJhNGNmMTEzNDgiLCJ0cyI6MTcwMzIwOTQ5ODMzNH0
Content-Type: application/json
User-Agent: OpenAPI

{
    "snDevEUI": "66003649xxxx",
    "name": "Sample VS121-P",
    "description": "VS121-P on meeting room 3D",
    "project": "Workplace-management"
}
Response example
HTTP/1.1 200 OK
{
    "data": {
        "sn": "66003649xxxx",
        "deviceId": "1737007595605147649"
    },
    "status": "Success",
    "requestId": "22bd34b548bca2981b4bb5f222523caf"
}