• Object Storage Service

obs
  1. Help Center
  2. Object Storage Service
  3. API Reference (Swift)
  4. Methods of Calling APIs
  5. Responses

Responses

OBS (compatible with OpenStack Swift) returns an HTTP response after receiving and processing a request.

Syntax

Status Line: HTTP-Version Status-Code Reason-Phrase
Response Headers
<Conditional Response Body>

Status Line

The first line of a response is the Status-Line, consisting of the protocol version, numeric status code, and textual phrases. The previous elements are separated by spaces. See Table 1.

Table 1 Status line elements

Element

Description

HTTP-Version

HTTP version. OBS (compatible with OpenStack Swift) uses HTTP 1.1.

Status-Code

Status code, which describes the response type.

Reason-Phrase

Reason phrase, which describes the status code in a short text.

The first digit of the status code defines the response type. The last two digits do not have this function. Status codes are classified into five types based on the first digit, as described in Table 2.

Table 2 Status codes in OBS (compatible with OpenStack Swift)

Status Code

Description

1xx

Prompts the client to wait because the server has received but is still processing the request.

2xx

Indicates that the request has been received, understood, and accepted.

3xx

Indicates that the client must take further actions to complete the request.

4xx

Indicates a client error. The request contains bad syntax or cannot be fulfilled.

5xx

Indicates a server error. The server failed to fulfill a valid request.

  • A 1xx status code indicates a provisional response. Table 3 describes the 1xx status code in OBS (compatible with OpenStack Swift).
Table 3 1xx status code

Status Code

Description

Returned After

100 Continue

Indicates that the initial part of the request has been received and has not yet been rejected by the server and the client should continue with its request.

  • PUT Object
  • POST Object
  • A 2xx status code indicates that a request has been successfully processed by the server. Table 4 describes all 2xx status codes in OBS (compatible with OpenStack Swift).
Table 4 2xx status codes

Status Code

Description

Returned After

200 OK

Indicates that the server has received and accepted the client's request.

  • List Objects
  • GET Object
  • GET Object Metadata

201 Created

Indicates that the response may contain an XML file. The XML file describes the response content.

  • PUT Container
  • PUT Object

202 Accepted

Indicates that the server has received the request.

  • POST operations (Update object metadata)

204 No Content

Indicates that the server has processed a request successfully and no content is returned.

  • HEAD Container
  • POST operations on access control lists (ACLs)
  • DELETE Object
  • DELETE Container
  • A 3xx status code indicates that a request can be successfully processed only after being redirected. Table 5 describes all 3xx status codes in OBS (compatible with OpenStack Swift).
Table 5 3xx status codes

Status Code

Description

Returned After

303 See Other

Indicates that a client can use another URL to get a specific object.

POST operations (provided that redirection parameters in requests are valid.)

304 Not Modified

Indicates that after the client has sent a GET request with the required modification time, access is allowed but the resource has not been modified after the specified time.

The resource is obtained but the modification time condition is not met.

307 Moved Temporarily

Indicates that a request has been redirected.

A request is redirected after it fails to be processed by the server.

  • A 4xx status code indicates that a request fails to be processed due to a client error. A 4xx status code is returned together with a response body containing error details. 4xx status codes apply to all request methods except HEAD. For more details, see the definition of 4xx status codes.
Table 6 4xx status codes

Status Code

Description

Returned After

400 Bad Request

Indicates that the syntax of a request is incorrect.

A request in incorrect syntax or containing incorrect parameters is sent.

401 Unauthorized

Indicates that the request failed to be authenticated.

The user does not exist or the authentication information in a sent request is incorrect.

403 Forbidden

Indicates that the server has refused the request.

The user does not have sufficient permissions.

404 Not Found

Indicates that the requested resource does not exist.

The requested resource (such as a container or object) does not exist.

411 Length Required

Indicates that a request header does not contain the required Content-Length or Transfer-Encoding field.

A request containing no Content-Length header is sent.

412 Precondition Failed

Conditions are not met.

Conditions are not met, if the object query request contain the If-Match or If-None-Match header.

413 Request Entity Too Large

Insufficient user quota.

User storage capacity exceeds user quota when uploading or replicating objects.

  • A 5xx status code indicates that the server encountered an error when processing the request or failed to process the request. Except for HEAD requests, a 5xx status code is returned together with a response body containing error details. Table 7 describes all 5xx status codes in OBS (compatible with OpenStack Swift).
Table 7 5xx status codes

Status Code

Description

Returned After

500 Internal Error

Indicates that an internal error occurred on the server.

An internal error occurred on the server.

503 Service Unavailable

Indicates that the server is overloaded.

The server is processing too many requests.

Response Headers

A response header is the information appended to a response, as described in Table 8. Response headers describe the server and contain further information about accessing the requested resource.

Table 8 Response headers

Header

Description

Applicable To

Content-Length

Indicates the length of a response body.

All responses (except those responses whose transfer-encoding is chunked)

Date

Indicates the date and time when a response was generated.

All responses

X-Trans-Id

Indicates a unique identifier generated by OBS (compatible with OpenStack Swift) for a request.

All responses

Content-Type

Indicates the object type returned.

All responses

NOTE:

OBS (compatible with OpenStack Swift) normalizes the content of the Content-Type. In comparison to the content returned by OpenStack Swift, the differences are as follows:

  • The character set is unified into charset=UTF-8 (UTF in uppercase) for the content of Content-Type.

Response Body

In OBS (compatible with OpenStack Swift), a response body is included in a request response under the following conditions:

  • GET Object

    If the object is not blank, the response body is the object body.

  • GET Account or Container

    The response body is account or container information.

  • Client error

    The response body describes the client error in detail in XML format so that the user can perform further operations. For details, see client error response codes.

  • Server error

    The response body describes the server error in detail in XML format so that the user can perform further operations.

Error Responses

OBS (compatible with OpenStack Swift) returns an error response if a request is incorrect, the permission is incorrect, or the requested container or object is not found. An error response describes the error. In the event of uploading an object, if the permission fails to pass the authentication, the following error information (in HTML format) is displayed:

<html><h1>Unauthorized</h1><p>This server could not verify that you are authorized to access the document you requested.</p></html>