• Cloud Container Engine

cce
  1. Help Center
  2. Cloud Container Engine
  3. API Reference
  4. APIs
  5. Parsing Responses

Parsing Responses

After receiving a request, the server will return an HTTP response.

A response consists of three parts: status line, response header, and response body.

Status Line

The format of a status line is as follows:

HTTP-Version Status-Code Reason-Phrase CRLF
  • HTTP-Version: version of the HTTP protocol used by the server.
  • Status-Code: status code in the response returned by the server.

    A status code consists of three digits. The first digit defines the category of a response. There are five categories:

    • 1xx: informational response, indicating that the request has been received and the recipient is continuing to process the request.
    • 2xx: success response, indicating that the request has been received, understood, and accepted.
    • 3xx: redirection response, indicating that further action needs to be taken by the requester in order to complete the request.
    • 4xx: client error response, indicating that the request contains a syntax error or cannot be fulfilled.
    • 5xx: server error response, indicating that the server fails to fulfill a valid request.
  • Reason-Phrase: text description of the status code.

Response Header

In most cases, a response header carries the following header fields:

Table 1 Standard HTTP response headers

Name

Description

Example

Date

Date and time when the response was sent.

The format of the date and time is defined in RFC 822.

Mon, 12 Nov 2007 15:55:01 GMT

Server

Software information that the server uses to process requests.

Apache

Content-Length

Length of the response body in octets.

xxx

Content-Type

Media type of the response body sent to the recipient.

application/json

Response Body

A response body is JSON text. The content of a response body is UTF-8 coded.