Request¶
Method¶
Method | URI | Description |
---|---|---|
PUT | /v1/{account}/{container}/{object}{?temp_url_sig,temp_url_expires,multipart-manifest} | Creates an object in the specified container. |
{account} indicates the name of an account. {container} indicates the name of a container. {object} indicates the name of an object.
The request body of this operation is the object content.
Example Request¶
Create an object:
curl -i $publicURL/marktwain/helloworld.txt -X PUT
-H "X-Auth-Token: $token"
Request Query Parameters¶
Table 2 describes the query parameters for getting the object content.
Parameter | Type | Description | Required or Not |
---|---|---|---|
temp_url_sig | String | Used with TempURL to sign the request. | No |
temp_url_expires | String | Used with TempURL to specify the expiry time of the signature. | No |
multipart-manifest | String | If multipart-manifest=put is set, the object is a static large object manifest and the body contains the manifest. | No |
Request Headers¶
Request URI parameters
Parameter | Type | Description |
---|---|---|
{account} | String (Required) | A unique account name. In the current version, it indicates a unique ID for the account. |
{container} | String (Required) | A unique container name. For details about container naming rules, see Naming Rules. |
{object} | String (Required) | An object name. For details about object naming rules, see Object Naming Rules. |
Header | Type | Description |
---|---|---|
X-Auth-Token | String (Required) | Authentication token. |
X-Object-Meta-name | String (Optional) | Object metadata, where {name} is the name of the metadata item. To delete this item, leave {name} empty in this header. You must specify an X-Object-Meta-{name} header for each metadata item (for each {name}) that you want to add or update. |
Content-Type | String (Optional) | Sets the MIME type of the object. |
X-Detect-Content-Type | Boolean (Optional) | If it is set to true, OBS guesses the content type based on the file name extension and ignores the value sent in the Content-Type header, if present. |
If-None-Match | String (Optional) | Only an If-None-Match: * header can be specified. If an object already exists, the object fails to be created and a 412 status code is returned. |
X-Object-Manifest | String (Optional) | Set to specify that this is a dynamic large object manifest object. The value is the container and object name prefix of the segment objects in the container/prefix format. UTF-8 encoding must be used. |
Content-Length | String (Optional) | Set to the length of the object content. Do not set if chunked transfer encoding is being used. |
Transfer-Encoding | String (Optional) | Set to chunked to enable chunked transfer encoding. If used, the Content-Length header is ignored. |
X-Copy-From | String (Optional) | The format is {container}/{object}. When this header is set, {container}/{object} is copied to create an object. UTF-8 encoding must be used. Using PUT with X-Copy-From has the same effect as using the COPY operation to copy an object. Using PUT with X-Copy-From has the same effect as COPY to create an object. |
ETag | String (Optional) | MD5 checksum value of the request body. If the MD5 checksum value of the request body is equal to the value of ETag, the upload was successful. If not equal, a 422 status code is returned. Checking the MD5 checksum value for an upload is recommended. |
Content-Disposition | String (Optional) | When the header is set to {newname} and an object is downloaded through a browser, the default object name {newname} is returned. |
Content-Encoding | String (Optional) | If this header is set, the value is the encoding format used when an object is downloaded through a browser. |
Note
If chunked transfer encoding is used and the value of Content-Length in a request is greater than the actual length of an object to be uploaded, OBS (compatible with OpenStack Swift) returns a 201 status code to indicate that the object was created successfully. In the same scenario, OpenStack Swift, in contrast, returns a 408 (Request Timeout) status code, even if but the object was created successfully.