bindDevice (Bind Device Documentation - Integration Guide - Imou Open Platform)
bindDevice: Bind Device Documentation - Integration Guide - Imou Open Platform
Function details
Bind the device to the specified account.
Guide: Integrate a camera · Bind state. Next: unBindDevice · Device add.
Request address
https://openapi-[DataCenter].easy4ip.com/openapi/bindDevice
Request format
HTTP POST. JSON body layout: Request conventions. Sign with Signature.
Incoming parameter description
| Parameter name | Parameter type | Required or not | Default value | Legal value | Parameter description |
|---|---|---|---|---|---|
| token | String | Yes | Administrator accessToken | ||
| deviceId | String | Yes | Device serial number | ||
| code | String | Yes | code is collectively referred to as device verification code, but the code value transmitted for different devices will be different. It is necessary to determine whether the device to be bound has an auth capability set: 1. If the device has an auth capability set, the code value transmits the device password after the device is initialized; 2. If the device does not have an auth capability set but the label at the bottom of the device (or two) In the dimension code) there is a 6-digit security code, and the code value transmits the 6-digit number; 3. If the device does not have an auth capability set and there is no 6-digit security code in the label at the bottom of the device (or in the QR code), then Just pass the code value blank. | Device verification code or password | |
| encryptCode | String | No | This parameter refers to the encrypted code value and is not mandatory. Either the code parameter or the encryptCode parameter can be used, and if both are passed, the code will prevail. If the business has a high demand for security, the encryptCode parameter can be used, and the encryption rules are as follows. | Encrypted device verification code or password |
Password encryption algorithm detailed description: Password calculated formula is: Base64(AES256_CBC(code, Key[], IV[]); Encryption rules are as follows: 1.The algorithm is AES/CBC/PKCS5Padding in the method of encrypting the CBC packet; 2.The code is the plaintext verification code or password of the device; 3.Key[] is a binary array of key (Key); 4.key is LowerCase(MD5(UpperCase(Base64(KDF(deviceId,MD5(appsecret)))))), the KDF algorithm is PBKDF2WithHmacSHA256, iterates 1200 times, exports the secret key length 256; 5.IV[] is the binary array of initialized vector, which is: MD5(Appsecret), encrypting the MD5 algorithm of MessageDigest with Java.
Encryption Example: The device ID is TESTQWERXXXX, the app secret is 12345qwert67890asdfg12345qwert, the original code is Admin123, and the calculated encryptCode is 5ZtW6b0Ttf1zOiFhqynKaA==
Sample input
{
"system":{
"ver":"1.0",
"appId":"lcdxxxxxxxxx",
"sign": "xjhCQBoJ9hRDsCjyDcHjtDNzRZ3ZJezcawsfWeiaoxU=",
"time":1603352833,
"nonce":"b52eb20c-c836-45d7-9a98-cded3cf2fa9b"
},
"id":"5d5c16ec-0ee4-4880-88dd-6ce602d1e138",
"params":{
"token":"At_00000ad9e6e87f0142eb92e207aec46a",
"deviceId":"TESTQWERXXXX",
"code":"Admin123"
}
}
Return data field description
No data returned
Sample output
{
"result":{
"msg":"The operation was successful.",
"code":"0"
},
"id":"5d5c16ec-0ee4-4880-88dd-6ce602d1e138"
}
Error codes
This method may return the codes below. See Return codes and Capability errors for the full catalog.
Gateway and auth (SN / TK / OP)
| Code | Meaning | Next step |
|---|---|---|
SN1001 | Signature error | Check sign per Development specification |
TK1002 | Token invalid or expired | Refresh accessToken |
OP1002 | Missing required parameter | Add required fields |
OP1003 | Invalid parameter | Match this page’s parameter table |
OP1009 | Permission denied | Check token and device bind/share grants |
OP1013 | Total call limit exceeded | Reduce call rate |
OP1014 | Daily per-interface limit exceeded | See Interface call limits |
DV1007 | Device offline | Wait until the device is online |
See Return codes · OP/SN/TK for the full catalog.
Sub-accounts (SUB)
| Code | Meaning | Next step |
|---|---|---|
SUB1001–SUB1002 | Sub-account lacks API permission | Update policy via addPolicy |
SUB1005 | Sub-account token expired | Refresh subAccountToken |
SUB1006 | No device grant for sub-account | Check Resource and device serial |
SUB1008 | Sub-account not bound to app | Create and bind the sub-account first |
See Return codes · SUB.
Device binding (DV10xx)
| Code | Meaning | Next step |
|---|---|---|
DV1001 | Bound to another account | Unbind or use another device |
DV1002 | Device does not exist | Verify serial number |
DV1003 | Already bound to current account | No need to bind again |
DV1005 | Verification code error | Check device label code |
DV1008 | Bind count limit exceeded | Unbind extra devices |
DV1011 | Device not bound | Bind first |
DV1029 | Device already bound | Do not bind again |
See Return codes · DV.
