Description
Feitian Integrity Intelligent IoT Platform provides HTTPSRest interface to the outside, and all requests adopt POST method. The encoding method is UTF-8, and the message body parameters and return results are in JSON format .
Note: You need to obtain Appkey and Appsecret before using the API. Appkey is used to identify the accessed application, and AppSecret is used to sign the transmission message when transmitting data.
Message signature description:
tep 1: The non-empty parameters in each interface are sorted according to the ascii code of the parameter name from small to large, and the URL key-value pair format is used to concatenate the string to be signed, namely
key1=value1&key2=value2&key3=value3
Spliced into strings.Suppose the parameters sent are:
{ appkey : 9A0A8659F005D6984697E2CA0A9CF3B7, timestamp :20181221162001, nonce : dpRxkhjbauiclpKoqt }
Data to be signed appkey=9A0A8659F005D6984697E2CA0A9CF3B7&nonce=dpRxkhjbauiclpKoqt×tamp=20181221162001
Step 2: Use apisecret as the signature key to sign A and get the signature result B
B=HmacSHA256(A, appsecret);
Step 3: Add B to the parameter list, and get the final data sent as:
{ appkey : 9A0A8659F005D6984697E2CA0A9CF3B7, timestamp :20181221162001, nonce : dpRxkhjbauiclpKoqt, sign:Base64(B) }
Signature example:
Manual
Step 1: Create my application
In order to run the development environment normally, you need to create an application and obtain the corresponding [application ID], [App security key] and [Message service address], the specific steps are as follows:
1.Click to enter Feitian Intelligent IOT platform login page, log in to Feitian Intelligent IOT platform.
2.In the list on the left side of the management platform, click [Add Application] to jump to the add application interface to add an application.
3.Enter [application name], application Descp (optional), click the [Save] button, the page jumps to the application list to view the newly added application’s [application ID] [App security key] [Message service address] and other key information , These parameters are needed during API initialization.
Step 2: Integrate the interfaces you need
After the application is added, you can integrate the interface according to your business needs, please refer to the detailed introduction of RESTful interface.
Device binding
Request address:https://serverurl/v1/audio/
Interface function: bind the terminal device and the merchant's QR code plate. Upload the device number and QR code plate identification to the message service platform. After the verification is passed, bind the device and code plate.
parameter name | Parameter Description | Is the value required |
---|---|---|
appkey | Application appkey | Yes |
method | Requested interface name,bindDevice | Yes |
devicesn | device ID | Yes |
paycode | Code plate number (the content of the QR code of the receipt code) | Yes |
timestamp | Timestamp, format yyyyMMddHHmmss | Yes |
nonce | Random string generated on the client side. No more than 32 bits in length | Yes |
sign | The signature of the request parameter Base64(HmacSHA256(parameter to be signed, appsecret)) The method of generating the character string to be signed is detailed in "Message Signature Instructions" | Yes |
parameter name | Parameter Description |
---|---|
code | Return response code |
msg | Result description |
nonce | The nonce when requested, bring it back as it is |
sign | Signature of response data Base64 (HmacSHA256 (parameter to be signed, appsecret)) The generation rules of the parameters to be signed are the same as the generation rules of the request signature |
Message push (using device code)
Request address:https://serverurl/v1/audio/
Interface function: push voice messages to specified devices.
parameter name | Parameter Description | Is the value required |
---|---|---|
appkey | Application appkey | Yes |
method | Requested interface name,push | Yes |
devicesn | Device number, you can specify the device number to push messages to the device | Yes |
message | Broadcast amount, int type, unit: cent | Yes |
push_template | Voice template (5 Alipay; 6 WeChat; 7 Scan (default); 8 UnionPay) | Yes |
timestamp | Timestamp, format yyyyMMddHHmmss | Yes |
nonce | Random string generated on the client side. No more than 32 bits in length | Yes |
sign | The signature of the request parameter Base64(HmacSHA256(parameter to be signed, appsecret)) The method of generating the character string to be signed is detailed in "Message Signature Instructions" | Yes |
parameter name | Parameter Description |
---|---|
code | Return response code |
msg | Result description |
nonce | The nonce when requested, bring it back as it is |
pushsn | Message serial number |
sign | Signature of response data Base64 (HmacSHA256 (parameter to be signed, appsecret)) The generation rules of the parameters to be signed are the same as the generation rules of the request signature |
Message push (using the code plate number)
Request address:https://serverurl/v1/audio/
Interface function: push voice messages to specified devices.
parameter name | Parameter Description | Is the value required |
---|---|---|
appkey | Application appkey | Yes |
method | Requested interface name,pushByPaycode | Yes |
paycode | Collection code, specify the collection code, and push messages to the bound device | Yes |
message | Broadcast amount, int type, unit: cent | Yes |
push_template | Voice template (5 Alipay; 6 WeChat; 7 Scan (default); 8 UnionPay) | Yes |
timestamp | Timestamp, format yyyyMMddHHmmss | Yes |
nonce | Random string generated on the client side. No more than 32 bits in length | Yes |
sign | The signature of the request parameter Base64(HmacSHA256(parameter to be signed, appsecret)) The method of generating the character string to be signed is detailed in "Message Signature Instructions" | Yes |
parameter name | Parameter Description |
---|---|
code | Return response code |
msg | Result description |
pushsn | Message serial number |
nonce | The nonce when requested, bring it back as it is |
sign | Signature of response data Base64 (HmacSHA256 (parameter to be signed, appsecret)) The generation rules of the parameters to be signed are the same as the generation rules of the request signature |
Get code plate binding device
Request address:https://serverurl/v1/audio/
Interface function: upload the QR code plate number and get the device number bound to the QR code plate.
parameter name | Parameter Description | Is the value required |
---|---|---|
appkey | Application appkey | Yes |
method | Requested interface name,getBindDevice | Yes |
paycode | Code plate number (the content of the QR code of the receipt code) | Yes |
timestamp | Timestamp, format yyyyMMddHHmmss | Yes |
nonce | Random string generated on the client side. No more than 32 bits in length | Yes |
sign | The signature of the request parameter Base64(HmacSHA256(parameter to be signed, appsecret)) The method of generating the character string to be signed is detailed in "Message Signature Instructions" | Yes |
Get device information
Request address:https://serverurl/v1/audio/
Interface function: check the information of a specified device.
parameter name | Parameter Description | Is the value required |
---|---|---|
appkey | Application appkey | Yes |
method | Requested interface name,getDeviceInfo | Yes |
devicesn | device ID | Yes |
timestamp | Timestamp, format yyyyMMddHHmmss | Yes |
nonce | The random number generated by the client. Maximum length 32 bits | Yes |
sign | The signature of the request parameter Base64(HmacSHA256(parameter to be signed, appsecret)) The method of generating the character string to be signed is detailed in "Message Signature Instructions" | Yes |
parameter name | Parameter Description |
---|---|
code | Return response code |
msg | Result description |
status | The binding status of the device (0 is not bound, 1 is bound) |
state | Device status (0 normal, 1 disabled) |
is_online | Whether online (0 online, 1 offline) |
version | current version |
last_online_time | Last online time |
last_offline_time | Last offline time |
location_info | Device location information, for example: {"descp","Xueqing Road, Haidian District, Beijing, near Huizhi Building"} |
nonce | The nonce when requested, bring it back as it is |
sign | Signature of response data Base64 (HmacSHA256 (parameter to be signed, appsecret)) The generation rules of the parameters to be signed are the same as the generation rules of the request signature |
Unbind device
Request address:https://serverurl/v1/audio/
Interface function: release the binding relationship between the terminal device and the QR code plate.
parameter name | Parameter Description | Is the value required |
---|---|---|
appkey | Application appkey | Yes |
method | Requested interface name,unbindDevice | Yes |
devicesn | device ID | Yes |
timestamp | Timestamp, format yyyyMMddHHmmss | Yes |
nonce | The random number generated by the client. Maximum length 32 bits | Yes |
sign | The signature of the request parameter Base64(HmacSHA256(parameter to be signed, appsecret)) The method of generating the character string to be signed is detailed in "Message Signature Instructions" | Yes |
parameter name | Parameter Description |
---|---|
code | Return response code |
msg | Result description |
nonce | The nonce when requested, bring it back as it is |
sign | Signature of response data Base64 (HmacSHA256 (parameter to be signed, appsecret)) The generation rules of the parameters to be signed are the same as the generation rules of the request signature |