Updated on 2024-11-01 GMT+08:00

Response

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

Status Code

A status code is a group of digits ranging from 2xx (indicating successes) to 4xx or 5xx (indicating errors). 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 in Getting a List of RAM Managed Permissions, 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

Default value: none

Connection

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

Type: string

Valid values: keep-alive | close

Default value: none

Date

Date when the RAM service responded to the request.

Type: string

Default value: none

X-Request-Id

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

Type: string

Default value: none

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 the API in Getting a List of RAM Managed Permissions, the following message body is returned:

{
    "permissions": [
        {
            "id": "7d04b6d4-00d5-41bd-b13c-22abd1ea249b",
            "name": "test-dns-zones",
            "resource_type": "dns:zone",
            "is_resource_type_default": true,
            "created_at": "2022-08-10T07:18:47Z",
            "updated_at": "2022-10-21T15:22:15Z"
        },
        {
            "id": "8c378992-2450-4b2e-9c94-58fe01c74397",
            "name": "test-dns-resolverRules",
            "resource_type": "dns:resolverRule",
            "is_resource_type_default": true,
            "created_at": "2022-08-10T07:50:02Z",
            "updated_at": "2022-10-25T17:27:01Z"
        },
......

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": "The resource type vpc:subnet has no permission",
    "error_code": "RAM.1009"
}

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