Upload

POSThttps://dreamapi-oss.oss-cn-hongkong.aliyuncs.com

The Upload API allows for direct client-side file uploads to our Object Storage Service (OSS). Once you have obtained the necessary parameters from the Get Upload Policy API, you can construct a standard multipart/form-data request to transfer files directly to the storage bucket, ensuring maximum speed and stability.

  • Use the host returned by the Policy API as your request URL.
  • Include the file content along with the authentication parameters provided by the server.
  • Important: The file parameter must be the final field in the form request.

Request Headers

No custom headers are required. This endpoint uses standard multipart/form-data specifications.

Request Body

success_action_status string Required

The HTTP status code to return upon a successful upload. Usually fixed to 200.

policy string Required

The security policy obtained from the Get Upload Policy API.

OSSAccessKeyId string Required

The OSSAccessKeyId provided by the Get Upload Policy API.

signature string Required

The digital signature provided by the Get Upload Policy API.

key string Required

The full object key (directory path + filename) provided by the Get Upload Policy API. Use the key value returned by that API directly.

callback string Required

The callback value provided by the Get Upload Policy API.

file binary Required

The binary content of the file to be uploaded. This must be the last parameter in the request body.

Response

code integer

Returns 0 for success, or a specific error code.

message string

Returns "success" or a descriptive error message.

data object
verifyStatus boolean

Indicates whether the upload integrity was successfully verified.

reqId string

The unique identifier for the upload request.

Errors

10192Illegal param
Request
cURL
curl --location --request POST 'https://dreamapi-oss.oss-cn-hongkong.aliyuncs.com' \
--form 'policy="eyJ0leHBpcmF0aW9uIjoiMjAyNC0xMS0xOVQwODo0NDo0OC42MzZaIiwiY29uZGl0aW9ucyI6W1siY29udGVudC1sZW5ndGgtcmFuZ2UiLDAsNTM2ODcwOTEyMF0sWyJzdGFydHMtd2l0aCIsIiRrZXkiLCJ0bXBcL2RyZWFtXC8yMDI0LTExLTE5XC81MzY5MjA3ODIwOTg5MDAyXC8iXV19"' \
--form 'OSSAccessKeyId="LTAI5tF1QzxoHGvEcziVACyc"' \
--form 'success_action_status="200"' \
--form 'signature="G2TzrhlybemHbfFakysY4j2EI2I="' \
--form 'key="tmp/dream/2024-11-19/5369207820989002/1.png"' \
--form 'callback="eyJ0jYWxsYmFja0JvZHlUeXBlIjoiYXBwbGljYXRpb24vanNvbiIsImNhbGxiYWNrVXJsIjoiaHR0cHM6Ly9uZXdwb3J0YWkuY29tL3ByZS1haWdjLXByaW50LTJiL2ZpbGUvdjEvY2FsbGJhY2siLCJjYWxsYmFja0JvZHkiOiJ7XCJmaWxlbmFtZVwiOiR7b2JqZWN0fSxcInNpemVcIjoke3NpemV9LFwibWltZVR5cFwiOiR7bWltZVR5cGV9LFwiaGVpZ2h0XCI6JHtpbWFnZUluZm8uaGVpZ2h0fSxcIndpZHRoXCI6JHtpbWFnZUluZm8ud2lkdGh9LFwiYnVja2V0XCI6JHtidWNrZXR9LFwiZXRhZ1wiOiR7ZXRhZ30sXCJmb3JtYXRcIjoke2ltYWdlSW5mby5mb3JtYXR9LFwiY29udGVudE1kNVwiOiR7Y29udGVudE1kNX0sXCJjbGllbnRJcFwiOiR7Y2xpZW50SXB9LFwicmVxSWRcIjoke3JlcUlkfSxcIm9wZXJhdGlvblwiOiR7b3BlcmF0aW9ufSxcImJpeklkXCI6XCI3MzJjOWNhYS0wYTJlLTRhYTEtODdkOS01MjQzMGE4ZjAzMTRcIn0ifQ=="' \
--form 'file=@"/2024.09/20e319b2-2c31-4977-b486-8cb37a0b6663.png"'
0Successful
{
  "code": 0,
  "message": "success", 
  "data": {
    "verifyStatus": false,
    "reqId": "732c9caa-0a2e-4aa1-87d9-52430a8f0314"
  }
}