Request Structure

Last Updated on : 2023-05-22 06:38:10download

This topic describes the API request methods, endpoints, and request header parameters.

Request method

The following API request methods are supported:

Method
Description
GET Requests the server to return the specified resources.
PUT Requests the server to update the specified resources.
POST Requests the server to perform the specified operations.
DELETE Requests the server to delete the specified resources.

When the request method POST is used, the Content-Type parameter must be set to application/json.

Endpoints

You can select an endpoint of the private cloud environment where your device is deployed.

Request header parameters

The following table lists common request header parameters that are used in the API operations. You must set the values of the required parameters in the request headers.

Parameter name
Type Parameter location
Required Description
client_id String header Yes The user ID.
sign String header Yes The signature that is generated by the specified signature algorithm.
sign_method String header Yes The signature digest algorithm. Set the value to HMAC-SHA256.
t Long header Yes The 13-digit standard timestamp.
access_token String header Yes The information about the specified token.
Note: This parameter is not required when you make API requests to get or refresh tokens.
lang String header No The type of language.
  • zh: Set the value to zh for the service that is deployed inside mainland China.
  • en: Set the value to en for the service that is deployed outside mainland China.
nonce String header No The universally unique identifier (UUID) automatically generated after an API is called.
Signature-Headers String header No The header field added with your signature.

Sample request

Take the API request to get the user list as an example. With 50 entires returned on each page, get the information about the user list from 00:00:00, May 1, 2021 to 00:00:00, May 15, 2021. The request to get the first page of users is as follows:

  • API request

    GET:https://${hosts}/v2.0/apps/schema/users?page_no=1&page_size=50&start_time=1619798400&end_time=1621008000
    
  • Request header

    client_id: 1KAD46OrT9HafiKd****
    sign: C5EFD19AD45E33A060C0BE47AEF65D975D54B2D70CBAA7A1ACA1A7D0E5C0****
    sign_method: HMAC-SHA256
    t: 1588925778000
    access_token: 3f4eda2bdec17232f67c0b188af3****
    nonce: 5138cc3a9033d69856923fd07b49****
    Signature-Headers: area_id:request_id
    area_id: 29a33e8796834b1**** // User-defined
    request_id: 8afdb70ab2ed11eb85290242ac13****// User-defined