Parsing Responses
After receiving and interpreting a request message, the server returns an HTTP response message.
A response also consists of three parts: a status line, a response header, and a response body.
Status Line
The format of the status line is as follows:
HTTP-Version Status-Code Reason-Phrase CRLF
- HTTP-Version indicates the version of the HTTP protocol used by the server.
- Status-Code indicates the 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 possible values for the first digit:
- 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 actions need to be taken 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 has failed to fulfill a valid request.
- Reason-Phrase indicates the text description of a status code.
Response Header
For details about common response headers, see Table 1.
Response Body
A response body is a JSON text. If an error occurs in calling an API, the server returns a response body containing an error code and error description.
Last Article: Initiating Requests
Next Article: Example
Did this article solve your problem?
Thank you for your score!Your feedback would help us improve the website.