Skip to main content

OpenAPI Guide

Token Encryption Transmission Guide

This guide aims to provide a detailed introduction on how to securely use RSA encryption algorithm for encrypted token transmission on our open platform. By following this guide, you will be able to ensure the highest level of protection for sensitive data during transmission between the client and server
For specific operations, please refer to

Token Encryption Process

  • Generate key pairs
    Developers need to apply for a token in the middleware application, and the system will generate a key pair. Developers download the token information (including the key ID, key, and public key), which will be used to encrypt the token and decrypt the private key
  • Token application, download
  1. Enter device management
    Enter device management, please refer to Device Management
  2. Token application and download
    Add or download tokens, please refer to Token Download for details.
  • API Interface Description
    The token information obtained by the system through security mechanisms is encrypted using RSA encryption algorithm to generate encrypted ciphertext. Subsequently, embed this ciphertext into the HTTP header of the API request as part of the authentication or authorization information, and then initiate the API request. This process ensures the confidentiality and security of token information during transmission, preventing the leakage of sensitive information (please refer to the following example code for encryption methods).

Example code

JAVA Example

Golang Example

.Net Example

Common request error codes

EncodingDescription
401Access token has expired and needs to be reacquired
404Interface address error
428User or tenant does not exist
429User not registered
500Internal server error
503Service busy, try again later
1000Data * * * already exists

Device timing data

Device timing data push

tip

The timing data reported by the accessible devices can be pushed to multiple devices at once, and the total number of data requests per time cannot exceed1000

URL: /dataPlatform/openapi

HTTP request method: Post

Request body type: Array

Authentication: Description of Request Header Fields (see API Call Demo)

Field NameField TypeRequiredLocationDescription
X-Source-SecretIdstringHeaderYesKey ID
X-Source-SecretKeystringHeaderYesKey encrypted text

Explanation of array single object

Field NameField TypeRequiredDescription
timestringNoDevice data collection time
DeviceNamestringYesDevice Name
functionTypestringYesDevice location name
buildingNamestringYesName of the building where the device is located(must be consistent with the registered building name of the device)
devEuistringNoUnique identifier of IoT device
valuedoubleNodevice point digit type value(choose between value and reading)
readingstringNoDevice Point Number Character Type Value(choose between value and reading)
unitstringNoDevice function type unit

Return result field description

Field NameField TypeDescription
codeintRequest response code, 200 indicates success
messagestringSystem message
isSuccessbooleanReturns True for success and False for failure

Return error code

SeeCommon Request Error Codes

Device details

tip

Can query the detailed information of a single device

URL: /device/v1/mn/{devEui}

HTTP request method: Get

Authentication: Description of Request Header Fields (see API Call Demo)

Field NameField TypeRequiredLocationDescription
X-Source-SecretIdstringHeaderYesKey ID
X-Source-SecretKeystringHeaderYesKey encrypted text

Request Parameters

Field NameField TypeRequiredDescription
devEuistringYesUnique identifier of IoT device

Return result field description

Field NameField TypeDescription
codeintRequest response code, 200 indicates success
messagestringSystem message
isSuccessbooleanReturns True for success and False for failure
dataobjectdevice details object

Device Details Data Object Field Description

Field NameDescription
nameDevice Name
aliasDevice alias
equModelDevice Model
pointsDevice location information corresponding to a single device (description of individual object fields under device points)
devEUIUnique identifier for IoT devices
locationDevice registration location information
isOnlineWhether the device is online (True indicates online, False indicates offline)
descriptionsDevice description
isIotIs it an IoT device (True is an IoT device, False is a non IoT device)
buildingNameDevice registration building name

Device Details Points Array Single Object Field Description

Field NameDescription
typeDevice Function Type Name
unitDevice Function Type Unit
bmsIdNon IoT Device Function Type ID
controlDoes it support reverse control (True can be reversed, False cannot be reversed)

Return error code

SeeCommon Request Error Codes

Device List Query

tip

Can query all device information that can be viewed under the current tenant

URL: /device/v1/mn/page

HTTP request: Get

Authentication: Description of Request Header Fields (see API Call Demo)

Field NameField TypeRequiredLocationDescription
X-Source-SecretIdstringHeaderYesKey ID
X-Source-SecretKeystringHeaderYesKey encrypted text

Request Parameters

Field NameField TypeRequiredDescription
currentintYesCurrent page
sizeintYesPage size
namestringNoDevice name(fuzzy matching)
devEuistringNooT device unique identifier(exact match)
buildingNamestringNoThe building name filled in during device registration(exact match)
equModelstringNoDevice model name(exact match)

Return result field description

Field NameField TypeDescription
codeintRequest response code, 200 indicates success
messagestringSystem message
isSuccessbooleanReturns True for success and False for failure
dataobjectdevice list object (total: total number of items, size: number of items per page, current: current page, records: device data)

设Description of individual object fields under device data records

Field NameDescription
nameDevice Name
aliasDevice alias
equModelDevice Model
pointsDevice location information corresponding to a single device (description of individual object fields under device points)
devEUIUnique identifier for IoT devices
locationDevice registration location information
isOnlineWhether the device is online (True indicates online, False indicates offline)
descriptionsDevice description
isIotIs it an IoT device (True is an IoT device, False is a non IoT device)
buildingNameDevice registration building name

Description of individual object fields under device points

Field NameDescription
typeDevice Function Type Name
unitDevice Function Type Unit
bmsIdNon IoT Device Function Type ID
controlDoes it support reverse control (True can be reversed, False cannot be reversed)

Return error code

SeeCommon Request Error Codes

Latest value query of Device location

tip

Can query all device information that can be viewed under the current tenant

URL: /device/v1/realtime/{devEui}/values

HTTP request method: Get

Authentication: Description of Request Header Fields (see API Call Demo)

Field NameField TypeRequiredLocationDescription
X-Source-SecretIdstringHeaderYesKey ID
X-Source-SecretKeystringHeaderYesKey encrypted text

Request Parameters

Field NameField TypeRequiredDescription
devEuistringUnique identifier of IoT device (exact match)

Return result field description

Field NameField TypeDescription
codeintRequest response code, 200 indicates success
messagestringSystem message
isSuccessbooleanReturns True for success and False for failure
dataarrayLatest value of device location

Description of individual object fields in device data

Field NameDescription
timeData collection time
DeviceNameDevice Name
buildingNameDevice registration building information
functionTypeSingle device point name
devEUIUnique identifier for IoT devices
valueDevice numeric type value
readingDevice Character Type Values
unitDevice Function type unit

Return error code

SeeCommon Request Error Codes

Device point historical value query

tip

Can query the data values of a single or all points under a certain device for a certain period of time(the time interval can only query data within one week)

URL: /device/v1/realtime/history

HTTP request method: Post

Authentication: Description of Request Header Fields (see API Call Demo)

Field NameField TypeRequiredLocationDescription
X-Source-SecretIdstringHeaderYesKey ID
X-Source-SecretKeystringHeaderYesKey encrypted text

Request Parameters

Field NameField TypeRequiredDescription
DeviceNamestringYesDevice Name (exact match)
functionTypestringNoDevice point name
startTimedatatimeNoStart time
endTimedatatimeNoEnd time
fieldstringYesDevice Point Value (VALUE is numeric, READING is character)
equModelstringNoDevice model name (exact match)

Return result field description

Field NameField TypeDescription
codeintRequest response code, 200 indicates success
messagestringSystem message
isSuccessbooleanReturns True for success and False for failure
dataarraydevice points numerical object

Device data array single field description

Field NameDescription
timeData collection time
DeviceNameDevice Name
buildingNameDevice registration building information
functionTypeSingle device point name
devEUIUnique identifier for IoT devices
valueDevice numeric type value
readingDevice Character Type Values
unitDevice location unit

Return error code

SeeCommon Request Error Codes

Data warehouse

Data push

tip

Can access dataset data (the fields and data types to be pushed should correspond to the dataset configuration), multiplecan be pushed at once (the total number of data requests per time cannot exceed 1000)

URL: /dataset/v1/{datasetName}

HTTP request method: Post

Authentication: Description of Request Header Fields (see API Call Demo)

Field NameField TypeRequiredLocationDescription
X-Source-SecretIdstringHeaderYesKey ID
X-Source-SecretKeystringHeaderYesKey encrypted text

Request body type: Array

Request Parameters

Field NameField TypeRequiredDescription
datasetNamestringYesDataset Code

Return result field description

Field NameField TypeDescription
codeintRequest response code, 200 indicates success
messagestringSystem message
isSuccessbooleanReturns True for success and False for failure

Return error code

SeeCommon Request Error Codes

Data query

tip

Can query the data values of a single or all points under a certain device for a certain period of time(the time interval can only query data within one week)

URL: /device/v1/realtime/history

HTTP request method: Get

Authentication: Description of Request Header Fields (see API Call Demo)

Field NameField TypeRequiredLocationDescription
X-Source-SecretIdstringHeaderYesKey ID
X-Source-SecretKeystringHeaderYesKey encrypted text

Request Parameters

Field NameField TypeRequiredDescription
templateCodestringYesDataset code
currentstringYesCurrent page
sizedatatimeYesNumber of articles per page

Return result field description

Field NameField TypeDescription
codeintRequest response code, 200 indicates success
messagestringSystem message
isSuccessbooleanReturns True for success and False for failure
dataobjectDataset List Object (total: total number of entries, size: number of entries per page, current: current page, records: dataset data)

Records single field description

Field NameDescription
{Configure Fields}: {Fields Value}Data dynamically displays columns and values based on configuration fields
......

Return error code

SeeCommon Request Error Codes