diacloud API文档说明v1.4.zh-CN.en
diacloud API文档说明v1.4.zh-CN.en
diacloud API文档说明v1.4.zh-CN.en
com
V1.4
➢ F6: The current data interface of the device register, the obtained data is incomplete?
➢ F7:APIcall limit
V1.4 2020-06-17 ➢ Time zone declaration for the interface
➢ The original interface "Get Register History Data Interface" was renamed "Get
➢ The original interface "Get the current data interface of the device register" was renamed
➢ Interface changes:
➢ Get a single historical data interface, add support for fixed time interval query
parameters
➢ new interface
1.6according toUTC+8Get the current data interface of the device register...................................................... ......................13
1.13according toUTCGet the current data interface of the device register...................................................... ................................28
1.14.2Introduction to the interface for obtaining historical data by register configuration................................................ ......................................31
F3: Displays that the setting is successful, but does not take effect................................................ .....................................................35
F5: The current data interface of the device register cannot be obtainedMDistrict data? ......................................................36
F6: The current data interface of the device register, the obtained data is incomplete? ...................................................... ......36
APIInterface classification: equipment basic information interface, all equipmentalarmInformation interface, single devicealarmInformation interface, security
tunnel list information interface, interface for obtaining current data of device register, interface for setting device register value, interface for obtaining
historical data of register, interface for deleting device. The following table is introduced:
Json
name Restful APIs illustrate
request type
Secure Tunnel List Information Get all secure tunnels under the account
/vlns get
interface Information
Set the number of device registers A certain device under the account of the device
/devices/{device_id}/regs put
value interface register value
Get the account under the account according to the change time
according toUTCclock acquisition Get the account under this account according to the UTC clock
device register current /v2/devices/{device_id}/regs get The current value of the device register.
Data interface
according toUTCclock acquisition Press UTC+8 to get all the accounts under this account
Information interface
according toUTCclock acquisition Press UTC+8 to get the specified under the account
Used to obtain the basic information of the device under the account
open url:https://api.diacloudsolutions.com.cn/
select the first one in the api list , select "basic auth" on the right
tunnel id Secure Tunnel ID ID number of the secure tunnel where the device is located
storage_state Cloud storage space status Whether the cloud storage space used by the device is full 1: normal, 0: used up
traffic_state Cloud traffic status Status of cloud traffic used by the device 1: normal, 0: used up
Note: Only the latest version V1.4 and above has this information.
eip Public network entrance IP For example: TCP: 211.97.129.248, the device uses TCP to connect to
Note: Only the latest version V1.4 and above has the delay for the
latency delay
information device to connect to the server, in ms
Used to get all the alarms information of the device under this account.
Note: The Alarm refers to the alarm set in the device web page. The detailed settings are in the device web page, [System
Settings] -> [Event Management], and select "Alarm Event" in the event type.
open url:https://api.diacloudsolutions.com.cn/
select the second one in the api list , select "basic auth" on the right
1,PagingPagination information
offset offset
2,Datameaning in
entry in data name illustrate
SMS sending status Whether the SMS is sent successfully 0: success 1 is failure (only recorded when using
sms.result
state cloud SMS)
SMS sent
sms.addr The mobile phone number to which the SMS is sent
phone number
mail sending Whether the email is sent successfully 0: success 1 is failure (only recorded when using cloud
email.result
fruit SMS)
https://api.diacloudsolutions.com.cn/alarms?page=2 If
query2018-01-01arrive2018-01-08
https://api.diacloudsolutions.com.cn/alarms?from=2018-01-01 00:00:00 & to=2018-01-09 00:00 Use & to
connect multiple conditions
Used to obtain all the alarms information of a device under the account.
Note: Alert sources and1.3 Press UTC+8 to get all devicesalarmInformation interface The alarms in are all the alarms set in the webpage
of the source device. For specific settings, see1.3 Press UTC+8 to get all devicesalarmInformation interface . Json request format:
url:https://api.diacloudsolutions.com.cn/devices/{device_id}/alarms method:
get
Request header:
Note: authoriz is authentication, followed by the base64 encrypted result of ("username":"password"). Note: Please replace
{device_id} with the id in data in the device information interface. For example, the ID in data is 21669
then the url ishttps://api.diacloudsolutions.com.cn/devices/21669/alarms
open url:https://api.diacloudsolutions.com.cn/
select the third one in the api list , select "basic" on the right
existurlreplacement equipmentIDNo21907(devices with an alarmID,equipmentIDFor the query method, please refer to the first basic information
interface)
Click【Send], the returnedjson:
3,PagingPagination information
offset offset
4,Datameaning in
entry in data name illustrate
SMS sending status Whether the SMS is sent successfully 0: success 1 is failure (only recorded when using
sms.result
state cloud SMS)
SMS sent
sms.addr The mobile phone number to which the SMS is sent
phone number
mail sending Whether the email is sent successfully 0: success 1 is failure (only recorded when using cloud
email.result
fruit SMS)
https://api.diacloudsolutions.com.cn/devices/21097/alarms?page=2
If query2018-01-01arrive2018-01-08
https://api.diacloudsolutions.com.cn/devices/21097/alarms?from=2018-01-01 00:00:00 &
to=2018-01-09 00:00
Use & to connect multiple conditions
Used to obtain the basic information of the secure tunnel under the account
Note: authoriz is authentication, followed by the base64 encrypted result of ("username":"password"). Introduction
open url:https://api.diacloudsolutions.com.cn/
select the fourth one in the api list , select "basic auth" on the right
After filling in the account and password, click [Send], the returnedjson:
Used to obtain the current register information of the specific device under the account
{device_id} with the id in data in the device information interface. For example, the ID in data is 21669
open url:https://api.diacloudsolutions.com.cn/
select the fifth in the api list , select "basic auth" on the right
After filling in the account and password, fill in the deviceIDAfter that, click [Send], the returnedjson:
The response is divided into two parts,countanddata,middlecountis the number of registers. indataThe
The time when the register value is uploaded. The format for this time is
Time time
UTC/GMT+08:00(East Eight District time).
templatet conversion script The original value needs to be processed and converted to the script displayed after the conversion
operate [More] -> [Register] on the far right, and more [Configuration] functions on the far right, and the corresponding alias.
1.7set device register value interface
Used to set specific device and register information under the account
Note: authoriz is authentication, followed by the base64 encrypted result of ("username":"password"). Note: Please replace
{device_id} with the id in data in the device information interface. For example, if the ID in data is 21669, the url ishttps://
open url:https://api.diacloudsolutions.com.cn/
select the sixth in the api list , select "basic auth" on the right
After filling in the account and password, fill in the deviceIDAfter that, there arepostdatacontent in . Click【Send], the result will be returned.202
Indicates that the operation is complete. If other settings fail, please confirm whether the network and parameters are correct.
Json request format for setting a certain register history information of a specific
url:https://api.diacloudsolutions.com.cn/devices/{device_id}/regs/{reg_addr }/
history
Request parameters:
page: optional
from: The start time parameter of the query history, optional. The time format isUTCclock, such as:2019-01-23 05:40:48. to: The
start time parameter of the query history, optional. The time format isUTCclock, such as:2019-01-23 05:40:48. gap: Fixed time
interval in seconds. If this parameter is default, the changed timestamp will be returned by default; if this parameter is filled,
Note: authoriz is authentication, followed by the base64 encrypted result of ("username":"password"). Note: Please replace
{device_id} with the id in data in the device information interface. For example, the ID in data is 21669 Note: The address of the
{reg_addr} register
Assuming that the historical data of the 2048 register with the device ID of 21907 needs to be obtained,
open url:https://api.diacloudsolutions.com.cn/
select the sixth in the api list , select "basic auth" on the right
After filling in the account and password, fill in the deviceIDand register number, click [Send], the returnedjson:
The response is divided into two parts,paginganddata,middlecountis the number of registers.
1,PagingPagination information
offset offset
iffromandtoThe parameters are all default, and the data within the last hour is returned by default, and the data is the most2000If the bar is at
equal time intervals, the request parameters are as follows. Inquire2020year2020-06-16One day of data, at regular intervals of60 Second.
https://api.diacloudsolutions.com.cn/devices/21907/regs/2048/history?from=2020-06-16
00:00:00 & to=2020-06-17 00:00:00&gap=60
ps: The historical data is called for a single time, and the number of returned records is the most1Ten thousand.
Used to and get the value of the specific register of all devices under this account.
JsonRequest format:
URL:https://api.diacloudsolutions.com.cn/regs?start={reg_start}&end={reg_end}
method: get
Request header:
Note: authoriz is authentication, followed by the base64 encrypted result of ("username":"password"). Note: where
Note: where {reg_end} needs to get the end address of the register number. Assuming that you need to get the historical data
of all the devices whose device IDs are 2048 and 2049 under your own account, the url is
https://api.diacloudsolutions.com.cn/regs?start=2048&end=2049 Introduction to
open url:https://api.diacloudsolutions.com.cn/ Since the interface has not yet been added to the API
list, just select one and then manually fill in the URL
Suppose you select the first one in the api list , select "basic auth" on the right
BundleURLchange tohttps://api.diacloudsolutions.com.cn/regs?start=2048&end=2049 input indiacloudOn
the registered cloud account, click [Refresh headers], will appearheadersContent.
"device_id": [
"device_id": ,
"addr": 2048,
"value": 0,
"name": "temperature",
"history": 1,
Device_id device id The unique identifier of the device on the cloud platform
Used to get all the alarms information of the device under this account.
Note: The Alarm refers to the alarm set in the device web page. The detailed settings are in the device web page, [System
Settings] -> [Event Management], and select "Alarm Event" in the event type.
open url:https://api.diacloudsolutions.com.cn/
select the second one in the api list , select "basic auth" on the right
1,PagingPagination information
offset offset
2,Datameaning in
entry in data name illustrate
SMS sending status Whether the SMS is sent successfully 0: success 1 is failure (only recorded when using
sms.result
state cloud SMS)
SMS sent
sms.addr The mobile phone number to which the SMS is sent
phone number
mail sending Whether the email is sent successfully 0: success 1 is failure (only recorded when using cloud
email.result
fruit SMS)
https://api.diacloudsolutions.com.cn/v2/alarms?page=2 If
query2018-01-01arrive2018-01-08
https://api.diacloudsolutions.com.cn/v2/alarms?from=2018-01-01 00:00:00 & to=2018-01-09 00:00
Used to obtain all the alarms information of a device under the account.
Note: Alert sources and1.11 Get all device alarm information interface according to UTC The alarms in are all the alarms set in the
webpage of the source device. For specific settings, see1.10 Get all devices in UTCalarmInformation interface . Json request format:
url:https://api.diacloudsolutions.com.cn/v2/devices/{device_id}/alarms method:
get
Request header:
Note: authoriz is authentication, followed by the base64 encrypted result of ("username":"password"). Note: Please replace
{device_id} with the id in data in the device information interface. For example, the ID in data is 21669
Select the third "basic auth" in the api list , select the right
existurlreplacement equipmentIDNo21907(devices with an alarmID,equipmentIDFor the query method, please refer to the first basic information
interface)
3,PagingPagination information
offset offset
4,Datameaning in
entry in data name illustrate
SMS sending status Whether the SMS is sent successfully 0: success 1 is failure (only recorded when using
sms.result
state cloud SMS)
SMS sent
sms.addr The mobile phone number to which the SMS is sent
phone number
mail sending Whether the email is sent successfully 0: success 1 is failure (only recorded when using cloud
email.result
fruit SMS)
https://api.diacloudsolutions.com.cn/v2/devices/21097/alarms?page=2
If query2018-01-01arrive2018-01-08
https://api.diacloudsolutions.com.cn/v2/devices/21097/alarms?from=2018-01-01 00:00:00 &
to=2018-01-09 00:00
Use & to connect multiple conditions.
Used to obtain the current register information of the specific device under the account
Note: authoriz is authentication, followed by the base64 encrypted result of ("username":"password"). Note: Please replace
{device_id} with the id in data in the device information interface. For example, the ID in data is 21669
open url:https://api.diacloudsolutions.com.cn/
After filling in the account and password, fill in the deviceIDAfter that, click [Send], the returnedjson:
The response is divided into two parts,countanddata,middlecountis the number of registers. indataThe
The time when the register value is uploaded. The time is in UTC
Time time
Clock (0 time zone).
templatet conversion script The original value needs to be processed and converted to the script displayed after the conversion
operate [More] -> [Register] on the far right, and more [Configuration] functions on the far right, and the corresponding alias.
1.14Get historical data interface by register configuration
The user can configure the type of the register on the website, and the data will be automatically combined in the background through this interface and returned.
from: The start time parameter of the query history, optional. The time format isUTCclock, such as:2019-01-23 05:40:48. to: The
start time parameter of the query history, optional. The time format isUTCclock, such as:2019-01-23 05:40:48. gap: Fixed time
interval in seconds. If this parameter is default, the default time interval returned is60seconds; if this parameter is filled, the
method: get
Request header:
Note: authoriz is authentication, followed by the base64 encrypted result of ("username":"password"). Note: Please replace
{device_id} with the id in data in the device information interface. For example, the ID in data is 21669 Note: The address of the
{reg_addr} register
Assuming that the historical data of the 2048 and 2050 registers with the device ID of 35236 needs to be
open url:https://api.diacloudsolutions.com.cn/
Select in the api list, select "basic auth" on the right
After filling in the account and password, fill in the deviceIDand register number, click [Send], the returnedjson:
The response is divided into three parts, wherecodeandmsg, indicating the request
When the calling data does not have permission, it will return failure.
device_id Device ID
If query2020-06-16arrive2020-06-17 https://api.diacloudsolutions.com.cn/devices/35236/
regshistory?regs=2048,2050&from=2020-06-16 00:00:00 & to=2020-06-17 00:00 :00
iffromandtoThe parameters are all default, and the data within the last hour is returned by default, and the data is the most2000If the bar is at
equal time intervals, the request parameters are as follows. Inquire2020year2020-06-16One day of data, at regular intervals of90 Second.
https://api.diacloudsolutions.com.cn/devices/35236/regshistory?
regs=2048,2050&from=2020-06-16 00:00:00 & to=2020-06-17 00:00:00&gap=90
ps: The historical data is called for a single time, and the number of returned records is the most1Ten thousand.
FAQ:common problem
call to modify registerAPIsWhen prompted: "please replace the variable in {} with the correct value”? The prompt
is as follows:
This is because when modifying the value, you need topost dataThe content that needs to be modified is shown in the figure below, and the modified content must be the
When returning an error message403, please check with the query information andURLis it right or not.
F3: Displays that the setting is successful, but does not take effect
When the register data is set, the success of its return means that the server receives the data and forwards it to the device. However, whether the device side has been
successfully executed, and whether it has received information that cannot be confirmed. Customers need to query and confirm by themselves through the interface for
obtaining the register value (generally,5After the internal data has not changed to the value that needs to be displayed, you need to retry) . set up
Unsuccessful problems usually have the following problems:
(1) The device network is unstable, network redialing often occurs, or the signal is poor. The data
APIWhat is obtained is the original value of the original register, which is16Bit unsigned integer. Often used in regular use32
Integer and floating point display. It is formed by combining the values of two adjacent registers. Suppose we want to
calculation needs to passdwordThe result is converted to float data jsScript example:convertfor thefloat
Table] in "Operation" -> "More" , in the pop-up window, select the registertable.
More can be configured in the register, the display type of the register, to check the conversion function written by yourself.
PS: The type of configuration here is just the front-end parsing script and will not affectAPIReturn value.
F5: The current data interface of the device register cannot be obtainedMDistrict data?
equipmentMRegional Planning for Register $1536to $2047, that is,M0Actually the register number is $1536,M1
is $1537 and so on toM511Yes2047. To getMarea, if you need to add search parameters?start=1536, an
example is as follows: https://api.diacloudsolutions.com.cn/devices/21669/regs?start=1536 .
F6: The current data interface of the device register, the obtained data is incomplete?
Get the current data interface of the device register, the default start parameter is from2048start. if usefulbitarea, as
shown below, with displayM0wait, it takesMIt starts withMarea. So it's not that the data is incomplete, butstartThe
APIcalls, whether or not from the same sourceIP, as long as it is the same account, the number of calls per hour cannot exceed10000
times (each in the first chapterAPIIf the interface is called once, it is counted as one call), otherwise the account may be restricted from
SimultaneouslyAPIThe call is not free, please consult the corresponding supply channel for the specific cost.
DX2100/DX2300
$900 900 384 RS232 ModbusNumber of master communication errors
(FW1.5later version)
DX2100/DX2300
$903 903 387 RS485 ModbusMaster station error number
(FW1.5later version)
DX2100/DX2300
$904 904 388 RS485 ModbusThe location of the first error
(FW1.5later version)
DX2100/DX2300
$905 905 389 RS485 Modbusfirst error code
(FW1.5later version)
DX2100/DX2300
$906 906 38A Modbus TCPnumber of errors
(FW1.5later version)
DX2100/DX2300
$907 907 38B Modbus TCPThe group of the first error
(FW1.5later version)
DX2100/DX2300
$909 909 38D Modbus TCPfirst error code
(FW1.5later version)
becauseapiThe communication status cannot be obtained, so it is necessary to passmodbus tcpRead the register data above and upload it to the
cloud. such as uploading485communication status.485The communication status related registers of the master station have error debugging903,
where the first article is located904, the first corresponding error code905. In the device web page,
Fill in the corresponding information as shown below. The figure below is the903After the register is associated to2200.After setting, click [Save]
communication status.