Skip to main content

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

NameLocationTypeRequiredSample valueDescription
x-oss-meta-*BODYstringNox-oss-meta-locationuser 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.
OSSAccessKeyIdBODYstringNoLTAI4Fw2NbDUCV8zYU******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-encryptionBODYstringNoKMSWhen 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-typeBODYstringNotext/h323because 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
versionBODYstringNo2016-01-01version of api
Cache-Control, Content-Type, Content-Disposition, Content-Encoding, ExpiresBODYstringNoNoneHTTP 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-aclBODYstringNoprivateWhen creating an object, specify the access permission of the object. Valid values: public-read, private, public-read-write
fileBODYstringYesMyFilename.txtfile 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-encryptionBODYstringNoSM4specifies 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
regionIdBODYstringYesNo sample value for this parameter.region id
success_action_statusBODYstringNo200when 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.
SignatureBODYstringNoNoneAccording 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_redirectBODYstringNoNoneURL 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-tokenBODYstringNoNoneif 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
keyBODYstringYes/user/a/objectName.txtThe 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-idBODYstringNo3dea0cae-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.
policyBODYstringNo{ "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

NameTypeSample valueDescription
RequestIDstring1E3D5A1E0-67CA-43DA-24BC-EAF2D5A1E4DCRequest id

Example

Successful Response example

{
"RequestID":"1E3D5A1E0-67CA-43DA-24BC-EAF2D5A1E4DC"
}

Failed Response example

{
"errorSample":
{
"resultCode":-1,
"resultMsg":"system error",
"result":null
}

}