Get started
  • English
  • 简体中文
Official Site
Get started
  • English
  • 简体中文
Official Site
  • Get started
  • Concepts
  • Guides
  • Device capabilities & events
  • API reference
    • Public conventions
    • Development specification
    • accessToken: Get administrator token
    • API request example
    • Return codes
    • Interface call limits
    • Account docking
    • Device APIs
      • bindDevice: Bind Device
      • unBindDevice: Unbind Device
      • Batch detail by device ID
      • Paged device detail
      • Query online status
      • Pre-bind information
      • Bind state
      • subAccountDeviceInfo
      • subAccountDeviceList
      • setDeviceSnap: Device snapshot
      • setDeviceSnapEnhanced: Device snapshot
      • timeZoneConfigByDay: Set Device Time Zone Daylight Saving Time (by time)
      • timeZoneConfigByWeek: Setting device time zone daylight saving time (per week)
      • timeZoneQueryByDay: Query device time zone daylight saving time (by date)
      • timeZoneQueryByWeek: Obtain device time zone daylight saving time (by week)
    • Device live broadcast
    • Push configuration
    • Cloud storage service
    • Resource pool quota
    • Legacy APIs (deprecated)
  • SDK and tools
  • Solutions
  • Platform and support
On this page
Function details
Request address
Request format
Incoming parameter description
Sample input
Return data field description
Sample output
Error codes
Related

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 nameParameter typeRequired or notDefault valueLegal valueParameter description
tokenStringYesAdministrator accessToken
deviceIdStringYesDevice serial number
codeStringYescode 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
encryptCodeStringNoThis 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)

CodeMeaningNext step
SN1001Signature errorCheck sign per Development specification
TK1002Token invalid or expiredRefresh accessToken
OP1002Missing required parameterAdd required fields
OP1003Invalid parameterMatch this page’s parameter table
OP1009Permission deniedCheck token and device bind/share grants
OP1013Total call limit exceededReduce call rate
OP1014Daily per-interface limit exceededSee Interface call limits
DV1007Device offlineWait until the device is online

See Return codes · OP/SN/TK for the full catalog.

Sub-accounts (SUB)

CodeMeaningNext step
SUB1001–SUB1002Sub-account lacks API permissionUpdate policy via addPolicy
SUB1005Sub-account token expiredRefresh subAccountToken
SUB1006No device grant for sub-accountCheck Resource and device serial
SUB1008Sub-account not bound to appCreate and bind the sub-account first

See Return codes · SUB.

Device binding (DV10xx)

CodeMeaningNext step
DV1001Bound to another accountUnbind or use another device
DV1002Device does not existVerify serial number
DV1003Already bound to current accountNo need to bind again
DV1005Verification code errorCheck device label code
DV1008Bind count limit exceededUnbind extra devices
DV1011Device not boundBind first
DV1029Device already boundDo not bind again

See Return codes · DV.

Related

  • Development specification
  • API conventions
  • Module index
listSubAccountDevice: Query the list of devices with permissions for the sub-account
unBindDevice: Unbind Device