Updated on 2024-03-15 GMT+08:00

Response

After sending a request, you will receive a response, including a status code, response header, and response body.

Status Code

After sending a request, you will receive a response, including a status code, response header, and response body.

A status code is a group of digits ranging from 1xx to 5xx. It indicates the status of a response. For more information, see Status Codes.

For example, if status code 200 is returned for calling the API used to query organization information, the request is successful.

Response Header

Similar to a request, a response also has a header, for example, Content-type.

Table 1 describes common response headers.
Table 1 Common response headers

Header

Description

Content-Type

Type of the resource content.

Type: string

No default value.

Connection

Whether the connection to the server is a long connection or a short connection.

Type: string

Valid values: keep-alive | close

No default value.

Date

Date when the server responded to the request.

Type: string

No default value.

X-Request-Id

Uniquely identifies the request. The value is generated by the service and can be used for troubleshooting.

Type: string

No default value.

Response Body

The body of a response is often returned in structured format as specified in the Content-type header field. The response body transfers content except the response header.

For example, the response body for the API used to query organization information is as follows:
{   
  "organization" : {     
        "id" : "o-fhkmi6mek7wlqdp6nideqhb47qwtjdsv",      
        "urn" : "organizations::0a6d25d23900d45c0faac010e0fb4de0:organization:o-fhkmi6mek7wlqdp6nideqhb47qwtjdsv",     
        "management_account_id" : "0a6d25d23900d45c0faac010e0fb4de0",     
        "management_account_name" : "xxxx",     
        "created_at" : "2022-08-24T06:31:46Z"   
   } 
}

If an error occurs during API calling, an error code and a message will be displayed. The following shows an error response body.

{
    "error_msg": "bad request for checking permission",
    "error_code": "Organizations.1008"
}

In the response body, error_code is an error code, and error_msg provides information about the error.