Bootstrap Device


Bootstrap Device API is used by the device to get its triple information and the EnOS MQTT/HTTP protocol public address. After obtaining the triple information using this API, the device can use the EnOS-provided device SDK to attempt a connection to EnOS.


Bootstrap Device API is compatible with Get Device Connection Info, with the following differences:


API Name

Function

Scenario Sample

Get Device Connection Info

Registered devices to get the triple information, including single-channel devices, multi-channel devices, gateway devices, and sub-devices.

Registered devices get the triple information for themselves, branch devices, or sub-devices.

Bootstrap Device

Direct-connected devices to get their own triple information and register themselves if they are unregistered.

Direct-connected devices register themselves.

Request Format


POST http(s)://{dps-address}/dev/bootstrap

For more information, see About Device APIs.

Request Parameters (Header)


Name

Required/Optional

Data Type

Description

Content-type

Required

String

The content or file type. Supports application/json only.

Request Parameters(Body)


Name

Required/Optional

Data Type

Description

deviceSn

Required

String

Device Serial No., which is unique in the registration group.

groupId

Required

String

The ID of the registration group which the device belongs to.

dpsSignMethod

Required

String

The signature algorithm. Supports sha256 only.

dpsSignTimestamp

Required

Long

The timestamp to generate the verification value in the dpsSign parameter.

dpsSign

Required

String

The verification value that is generated by SHA256 algorithm based on the registration group password, deviceSn, and dpsSignTimestamp as inputs. You can find the registration group password in EnOS Management Console > Device Provisioning > Registration Group Management.

deviceName

Required

StringI18n

The device name. Internationalized name representation >>

timezone

Required

String

The timezone of the device. Timezone representation >>

Response Parameters


Name

Data Type

Description

murl

String

The EnOS MQTT protocol public address for the device’s environment.

hurl

String

The EnOS HTTP protocol public address for the device’s environment.

pk

String

The product key in the triple information of the device.

dk

String

The device key in the triple information of the device.

ds

String

The device secret in the triple information of the device.

Error Codes

Code

Message

Description

10000

[{sn}] not allocated

If the device is unallocated and the “Auto Activation” of the registration group is not enabled, the triplet cannot be obtained and an error message indicating the device is unallocated will be returned.

Samples

Request Sample


url: http://{dps-address}/dev/bootstrap
method: POST
requestBody:
    {
        "dpsSignMethod":"sha256",
        "dpsSignTimestamp":1649147455506,
        "dpsSign":"507db95cfff7f648cd80e67b7ced48c13d6913916348cde03ea668ca6b03927a",
        "groupId":"groupId",
        "deviceSn":"deviceSn",
        "deviceName":{"defaultValue":"abc"},
        "timezone":"+08:00"
    },
Content-Type: application/json

Return Sample


{
    "murl": "tcp://mqtt-{address}:11883",
    "hurl": "http://iot-http-{address}",
    "pk": "productKey",
    "dk": "deviceKey",
    "ds": "deviceSecret"
}