Common parameters are required in all Cloud Storage Gateway (CSG) API requests. Common parameters include common request parameters and common response parameters.

Common request parameters

Common request parameters must be included in all CSG API requests.

Table 1. Common request parameters
Parameter Type Required Description
Format String No The type of the returned value. The returned value can be displayed in the JSON or XML format. Default value: JSON.
Version String Yes The version number of the API. Specify the version number in the YYYY-MM-DD format. Set the value to 2018-05-11.
AccessKeyId String Yes The AccessKey ID provided to you by Alibaba Cloud.
Signature String Yes The signature string of the current request. For more information about how signatures are calculated, see Request signatures.
SignatureMethod String Yes The encryption method of the signature string. Set the value to HMAC-SHA1.
Timestamp String Yes The timestamp of the request. Specify the time in the ISO 8601 standard in the yyyy-MM-ddTHH:mm:ssZ format. The time must be in UTC.

Example: 2013-01-10T12:00:00Z, which specifies 20:00:00 on January 10, 2013 (UTC+8).

SignatureVersion String Yes The version of the signature encryption algorithm. Set the value to 1.0.
SignatureNonce String Yes A unique, random number used to prevent replay attacks. You must use different numbers for different requests.

Common response parameters

Every response returns a unique request ID regardless of whether the call is successful.

Sample requests

http://sgw.cn-shanghai.aliyuncs.com/
?Format=xml
&Version=2018-05-11
&Signature=Pc5WB8gokVn0xfeu%2FZV%2BiNM1dgI%3D 
&SignatureMethod=HMAC-SHA1
&SignatureNonce=15215528852396
&SignatureVersion=1.0
&AccessKeyId=key-test
&OwnerId=12345678
&Timestamp=2014-10-10T12:00:00Z

Sample response

After you send an API request, the system returns a response in a uniform format. A returned HTTP status code 2xx indicates that the request is successful. A returned HTTP status code 4xx or 5xx indicates that the request fails. Responses can be returned in either the JSON or XML format. You can specify the response format in the request. The default response format is XML. For ease of reading, the sample responses are formatted. The actual responses do not include any line breaks or indentations.

Sample success responses
  • XML format
    <?xml version="1.0" encoding="utf-8"?> 
        <!--Result Root Node-->
        <API Name+Response>
            <!--Returned Request Tag-->
            <RequestId>4C467B38-3910-447D-87BC-AC049166F216</RequestId>
            <!--Returned Result Data-->
        </API Name+Response>             
  • JSON format
    {
        "RequestId":"4C467B38-3910-447D-87BC-AC049166F216",
        /*Returned Result Data*/
    }
Sample error responses

If an error occurs when you call an API operation, no result data is returned. You can troubleshoot an error based on the error codes that are specific to an API operation.

If an error occurs when you call an API operation, a 4XX or 5XX HTTP status code is returned. The returned response body contains the specific error code and error message. The response body also contains the RequestId parameter that indicates the globally unique request ID and the HostId parameter that indicates the ID of the site that you requested. If you cannot identify the cause of the error, you can contact the Alibaba Cloud customer service staff and provide the returned HostId and RequestId to help the staff resolve the error.
  • XML format
    <?xml version="1.0" encoding="UTF-8"?>
    <Error>
       <RequestId>8906582E-6722-409A-A6C4-0E7863B733A5</RequestId>
       <HostId>sgw.cn-shanghai.aliyuncs.com</HostId>
       <Code>GatewayInOperation</Code>
       <Message>The gateway is processing requests . Try again later.</Message>
    </Error>                
  • JSON format
    {
        "RequestId": "7463B73D-35CC-4D19-A010-6B8D65D242EF",
        "HostId": "sgw.cn-shanghai.aliyuncs.com",
        "Code": "GatewayInOperation",
        "Message": "The gateway is processing requests . Try again later."
    }