API Usage

The platform provides an open API interface. Users can make HTTP/HTTPS (HTTPS is recommended) call to perform device management, data query, interaction through commands and other operations. On the basis of API, they can build upper-level applications according to their individual needs.

API Service Address

API address: api.onenet.hk.chinamobile.com

API Authentication

In order to improve API access security, OneNET API authentication parameters exist as header parameters.

In MQTT IoT Suite, accessKey is used as a core secret key. Users should use this core secret key to calculate a signature with the signature algorithm so as to form a token together with other parameters, and then authenticate the token as a request Header parameter. Please refer to the Token Algorithm

Here is an example token:

version=2018-10-31&res=products%2F123123&et=1537255523&method=sha1&sign=ZjA1NzZlMmMxYzIOTg3MjBzNjYTI2MjA4Yw%3D

Invoke Examples

(taking "API for retrieving device details" as an example)

GET /devices/3532392 
Authorization: version=2018-10-31&res=products%2F123123&et=1537255523&method=sha1&sign=ZjA1NzZlMmMxYzIOTg3MjBzNjYTI2MjA4Yw%3D

API Return

Returned by API, HTTP status codes are classified as follows:

HTTP Status Code Description
2xx Executed Successfully
4xx Client Error. In this case, the client usually needs to modify the request and then send it again.
5xx Server Error

API returns as follows:

{
    "request_id": "855b2fe4-3f54-41f2-8cd5-3e34bcfa8356",
    "code_no""000000",
    "code""onenet_common_success",
    "message""success",
    "data":{}   /* return result data */
}

The fixed parameters therein are described as follows:

Parameter Parameter Description
request_id A unique ID assigned by the platform for each request
code_no Error Code
code Error code description
message Error code details
data Returned data from the request

For error code description, please refer to Error Code Details

个搜索结果,搜索内容 “

    0 个搜索结果,搜索内容 “