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.
The request URI consists of the following parts.
{URI-scheme} : // {Endpoint} /? {query-string}
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.
go to your console. In menu Development Configuration >>「Cloud API」 Obtained in see get Endpoint
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
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. |
see API list
query the parameters of the API you want to call
java code exampleto help you understand how to construct API requests