1 Project Background#
2 Communication Method#
Interface communication:
Uses the HTTP protocol with the default POST method and JSON data format.3 Access Procedure#
1.
The administrator logs in to the system and obtains the pId and secretKey of the requestor. (Go to Settings > OpenAPI Management to add an access information as shown below.)
pId: Requestor ID
secretKey: Requestor secret key which can be modified
2. Develop according to the service requirements and interface documents of the requestor.
3. After encryption is enabled, you need to transmit the request parameters in an encrypted way. You can transmit them directly without encryption. Please refer to the following example.
Encrypted
Unencrypted
The interface message includes two parts: header and body. The following description is the body which must include the following four parts.
body: Interface request parameters only
sign: The message signature
pId: Project ID of the requestor
timeStamp: The current time, accurate to millisecondsEncrypted
Transmit the ciphertext as follows.
Request parameters:{
"body": "yqJeC3BgcOHfKReCHzmhtp8VH1Fr3vxi",
"sign": "MjI0OGYzMGQwMjhlMmI4YTNmMjM2MjE3MjYzYTFkODg=",
"pId": "1",
"timeStamp": "1631949094265"
}
Unencrypted
Transmit the plain text as follows.
Request parameters:{
"body": {
"deviceId": 0
},
"sign": "YjlhMWRmZTVlNzJhYTg4MTgzMDFhNTdlOWE0NjMyNDc=",
"pId": "YmRj",
"timeStamp": "1689586062335"
}
TimeStamp: The current time, accurate to millisecondsSign: The message signature The signing rules are as follows.
Enable encryption: Base64 (md5 (body ciphertext + timestamp + pId + secretKey))
Disable encryption: Base64 (md5 (timestamp + pId))
The body is business data.
Enable encryption: Base64 (DES (body plain text))
Disable encryption: body plain text
Note: md5 should be processed in hexadecimal format.
1.
Output Messages
Device response format/basic message
{
"status": 0,
"msg": “”,
"sign": "", message signature
"body": ""
}
Status: “0” represents success, and other values represent failure.
sign: The message signature whose rules are the same as the input data
body: he business data whose rules are the same as the input data
Note: When a non-interface error is reported, the response message will only be as follows.
{
"status": System error code,
"msg": “”,
"body": ""
}
Only the plain text of the body is described in the following input and output messages.
2. Message Signing and Encryption Examples
Des encrypt:
def des_encrypt(s):
"""
DES encrypt
:param s: Raw string
:return: Encrypted string, hexadecimal format
"""
secret_key = KEY
iv = secret_key
k = des(secret_key, ECB, iv, pad=None, padmode=PAD_PKC5)
en = k.encrypt(s, padmode=PAD_PKCS5)
return base64.b64encode(en).decode('ascii')
def des_decrypt(s):
"""
DES decrypt
:param s: Encrypted string, hexadecimal format
:return: Decrypted string
"""
secret_key = KEY
iv = secret_key
k = des(secret_ke
5 Interface Address#
The ${ root } of the interface address is a fixed part of the URL.Each interface URL description below will omit the ${ root } portion and only the following content is described.Note: The interfaces in the following examples are called in an unencrypted way. All request parameters not marked as optional are mandatory.Modified at 2026-02-09 02:26:10