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/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.
tag No Array<String> Specify tags to help you identify and categorize devices. One device supports to add 20 tags at most.
model No String Device model.
customAppKey No String Only LoRa devices support this setting. If not set, the default AppKey will be used to register the device.

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 Long 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/devices HTTP/1.1
Host: demo.milesight.com
Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCIsImtpZCI6InllYXN0b25lLWRlZmF1bHQta2V5LWlkIn0.eyJncmFudF90eXBlIjoiY2xpZW50X2NyZWRlbnRpYWxzIiwic2NvcGUiOlsib3BlbmFwaSJdLCJjbGllbnRfZXh0Ijp7ImFwcF9pZCI6IjE3MzY5NTQ4MDE3MTMzMjgxMzAifSwiZXhwIjoxNzAzMjEzMDk4LCJhdXRob3JpdGllcyI6WyJST0xFX0NMSUVOVCJdLCJqdGkiOiJiYjJjN2U4Yy03NGQwLTQ4NjEtODE3MS1iYTc0NWRlMGY0NmQiLCJjbGllbnRfaWQiOiI4OTNkNzdjNy1mMGNiLTRmMzQtOWNhMS03YzJhNGNmMTEzNDgiLCJ0cyI6MTcwMzIwOTQ5ODMzNH0
Content-Type: application/json

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