Construct request

Last Updated on : 2025-09-17 09:12:40Copy for LLMView as MarkdownDownload PDF

this topic describes how to construct API invocation requests. You can use tools such as curl or postman to test and verify the constructed request.

1. How to construct request

The request URI consists of the following parts.
{URI-scheme} : // {Endpoint} /? {query-string}

  • URI-scheme : indicates the protocol used to transmit the request. Currently, all Apis use HTTPS agreement.
  • Endpoint : specify the domain name (or IP) and port of the server hosting the API Service Endpoint. Different service instances have different endpoints 「Cloud API」Is obtained.
  • query-string query parameters, which are divided into public parameters and interface parameters. Common parameters are parameters that all interfaces need to pass, such as signature information and timestamp. The interface parameter is a parameter specified by an interface to be called, such as an interface name (Action).
    For example, if you want to query the device list of a product in the demo environment, you need to use the Endpoint of the demo environment and find the corresponding interface name (QueryDevice). Spell it as follows:
https://endpoint/? Action=QueryDevice&SignatureNonce=8d6131cab4e6465d975ba65ba4d45aad&AccessKeyId=xMr9wgwXQLhv5AUa65o03mcD&SignatureMethod=HMAC-SHA1&Timestamp=2024-11-17T09:41:41Z&ProductKey=dwwAsxAkOwT7xhIY&Signature=Gg4HDRr8kYn2R0mYDI5hwOvrJDI%3D  

As you read below, you can understand it in conjunction with the request example above.

You can use the curl Command in the terminal for test verification.

curl https://endpoint/? Action=QueryDevice&SignatureNonce=8d6131cab4e6465d975ba65ba4d45aad&AccessKeyId=xMr9wgwXQLhv5AUa65o03mcD&SignatureMethod=HMAC-SHA1&Timestamp=2024-11-17T09:41:41Z&ProductKey=dwwAsxAkOwT7xhIY&Signature=Gg4HDRr8kYn2R0mYDI5hwOvrJDI%3D

to construct an API request, you need to know how to obtain the endpoint and how to splice the queryString.

2. How to get the Endpoint

go to your console. In menu Development Configuration >>「Cloud API」 Obtained in see get Endpoint

3. How to construct query-string

according to the http specification, query-string it is generally composed of a series of key-value pairs, which are used between keys and values. = connection, between multiple key-value pairs. & connect. For example, what? name=John&age=30 , in which name and age is the key, John and 30 is the corresponding key value. Both keys and values should follow URL encoding rules to ensure proper transmission of special characters.
Key-value pairs can be divided common Parameters and Interface Parameters
common Parameters and interface Parameters splice a complete query-string without distinction

3.1. Public parameters

as the name implies, public parameters have nothing to do with the interface, that is, parameters that each API needs to use.

Name type required example description
AccessKeyId String yes xMr9wgwXQLhv5AUa6****mcD the key ID issued by the platform to the developer to call the interface, in the console get accessKey
Signature String yes Gg4HDR**kYn2R0mYDI5hwOvrJDI%3D the signature result. The security mechanism used by the platform to verify the identity of the request. For detailed calculation methods, see compute Signature
SignatureMethod String no HMAC-SHA1 currently only supports HMAC-SHA1 . Do not fill in the default HMAC-SHA1
Timestamp String yes 2024-11-17 T09:41:41Z the timestamp of the request. The date format follows the ISO8601 standard and requires UTC time . The format is YYYY-MM-ddTHH:mm:ssZ .
For example, 2024-11-17 T09:41:41Z
the platform will verify that the time error of more than 20 minutes is illegal.
SignatureNonce String yes 8d6131cab4e6465d975ba65ba4d45aad unique random number. Used to prevent network replay attacks. Users use different random numbers in different requests.

3.2. Interface Parameters

see API list
query the parameters of the API you want to call

4. Code example

java code exampleto help you understand how to construct API requests