PostObject
Description
PostObject upload files to the specified Bucket using HTML forms.
Request Method
POST
Request Path
/apsara/route/OneRouter/PostObject
Request Parameters Common Parameters
Name | Location | Type | Required | Sample value | Description |
---|---|---|---|---|---|
x-oss-meta-* | BODY | string | No | x-oss-meta-location | user specified user meta value. Default value: None If the request carries a form field prefixed with x-oss-meta-, it is considered a user meta, such as a x-oss-meta-location. Description An Object can have multiple similar parameters, but the total size of all user meta cannot exceed 8KB. |
OSSAccessKeyId | BODY | string | No | LTAI4Fw2NbDUCV8zYU****** | Bucket owner's AccessKeyId. default value: none limit: when Bucket is not public-read-write or provides Policy (or Signature) form fields, OSSAccessKeyId form fields must be provided. |
x-oss-server-side-encryption | BODY | string | No | KMS | When creating an Object, specify the server-side encryption method. Value: AES256, KMS or SM4 after specifying this parameter, this parameter is returned in the response header. OSS encrypts and stores the uploaded object. When the object is downloaded, the response header contains the x-oss-server-side-encryption, and the value is set to the encryption algorithm of the object. |
x-oss-content-type | BODY | string | No | text/h323 | because the browser will automatically add Content-Type to the file form field, in order to solve this problem, OSS supports users to add x-oss-content-type to the Post request body, which allows users to specify Content-Type and has the highest priority. priority order: x-oss-content-type & gt; Content of file form fields-type & gt; Content-type default value: none |
version | BODY | string | No | 2016-01-01 | version of api |
Cache-Control, Content-Type, Content-Disposition, Content-Encoding, Expires | BODY | string | No | None | HTTP request header. for details, please refer to PutObject. Default value: no Post operation submission form code must be multipart/form-data, that is, the Content-Type in Header is multipart/form-data;boundary = xxxxxx is boundary as a boundary string. |
x-oss-object-acl | BODY | string | No | private | When creating an object, specify the access permission of the object. Valid values: public-read, private, public-read-write |
file | BODY | string | Yes | MyFilename.txt | file or text content. The browser will automatically set the Content-Type according to the file type and overwrite the user's settings. OSS can only upload one file at a time. Default value: None note file must be the last field in the form. |
x-oss-server-side-data-encryption | BODY | string | No | SM4 | specifies the encryption algorithm of the object. If this option is not specified, Object uses the AES256 encryption algorithm. This option is only available if x-oss-server-side-encryption is valid for KMS. Value: SM4 |
regionId | BODY | string | Yes | No sample value for this parameter. | region id |
success_action_status | BODY | string | No | 200 | when no success_action_redirect form field is specified, the form field specifies the status code returned to the client after the upload is successful. default value: none valid values: 200, 201, 204 (default). if the value of the field is 200 or 204,OSS returns an empty document and the corresponding status code. if the value of this field is set to 201,OSS returns an XML file and 201 status code. if the value of the field is not set or set to an illegal value, OSS returns an empty document and 204 status code. |
Signature | BODY | string | No | None | According to the signature information calculated by the AccessKeySecret and Policy, OSS verifies the signature information to verify the legitimacy of the Post request. default value: none limit: when Bucket is not public-read-write or OSSAccessKeyId (or Policy) form fields are provided, Signature form fields must be provided. description form fields are not sensitive to case, but the values of form fields are sensitive to case. |
success_action_redirect | BODY | string | No | None | URL to which the client jumped after the upload was successful. If the form field is not specified, the return result is specified by the success_action_status form field. If the upload fails, OSS returns an error code and does not jump. Default value: None |
x-oss-security-token | BODY | string | No | None | if STS temporary authorization is used for this access, you need to specify the item as the SecurityToken value and OSSAccessKeyId the temporary AccessKeyId matched with it. When calculating the signature, it is consistent with the common AccessKeyId signature method. Default value: None |
key | BODY | string | Yes | /user/a/objectName.txt | The name of the upload object. If the name contains a path, such as a/B/c/B .jpg, OSS automatically creates the corresponding folder. Default value: None |
x-oss-server-side-encryption-key-id | BODY | string | No | 3dea0cae-5fd6-4bf8-8574-87c557****** | indicates the user master key hosted by KMS. This parameter is in x-oss-server-side-encryption Valid when the value of is KMS. |
policy | BODY | string | No | { "expiration": "2014-12-01T12:00:00.000Z ", "conditions ": [ {"bucket": "johnsmith"} ["starts-with", "$key", "user/eric/"] ]} | Policy specifies the legality of the request form field. Requests that do not contain Policy form fields are considered anonymous requests and can only access the bucket of public-read-write. For a policy example, see Post policy. default value: none limit: when Bucket is not public-read-write or OSSAccessKeyId (or Signature) form fields are provided, Policy form fields must be provided. description forms and policies must use UTF-8 encoding. |
Return data
Name | Type | Sample value | Description |
---|---|---|---|
RequestID | string | 1E3D5A1E0-67CA-43DA-24BC-EAF2D5A1E4DC | Request id |
Example
Successful Response example
{
"RequestID":"1E3D5A1E0-67CA-43DA-24BC-EAF2D5A1E4DC"
}
Failed Response example
{
"errorSample":
{
"resultCode":-1,
"resultMsg":"system error",
"result":null
}
}