Obtaining Authorization for Multipart Upload
Functions
When a client requests for creating a media asset larger than 20 MB, the media asset needs to be uploaded to OBS by part. The client needs to obtain authorization using this API each time before uploading a file part to OBS.
This API is used to obtain a temporarily authorized URL for initializing multipart upload, uploading parts, merging parts, listing uploaded parts, and canceling part merging. You need to configure the HTTP request method, request header, and request body by following the OBS API reference. Then you can request for the corresponding temporarily authorized URL.
The multipart upload method is the same as that in the OBS API reference, including the HTTP request method, request header, and request body. This API is used to generate authentication information (sign_str) to replace the URL in the OBS API, so that you have the temporary permission for uploading files to the bucket of VOD.
When calling the API for obtaining authorization, input bucket, object_key, and http_verb. bucket and object_key are obtained from the target field in the response body returned by the API for uploading media assets to VOD. http_verb varies depending on the specified operation.
URI
GET /v1.0/{project_id}/asset/authority
Parameter |
Mandatory |
Parameter Type |
Description |
---|---|---|---|
project_id |
Yes |
String |
Project ID. See Obtaining the Project ID. |
Parameter |
Mandatory |
Parameter Type |
Description |
---|---|---|---|
http_verb |
Yes |
String |
HTTP method for calling the OBS API for multipart upload. For details about the suitable HTTP method, see the OBS API reference.
|
bucket |
Yes |
String |
Bucket name. Value of bucket obtained in the target field in the response body returned by the API for uploading media assets to VOD. |
object_key |
Yes |
String |
Object name. Value of object obtained in the target field in the response body returned by the API for uploading media assets to VOD. |
content_type |
No |
String |
content-type of the file type. This parameter is mandatory for upload task initialization. Configure the parameters by referring to Uploading a Media Asset Greater Than 20 MB by Part.
|
content_md5 |
No |
String |
MD5 value of each uploaded part. |
upload_id |
No |
String |
ID of each upload task, which is returned after OBS initializes the multipart upload task. This field is mandatory except for upload task initialization. |
part_number |
No |
Integer |
ID of each uploaded part. Value range: 1–10,000 |
Request Parameters
Parameter |
Mandatory |
Parameter Type |
Description |
---|---|---|---|
X-Auth-Token |
No |
String |
User token. This parameter is mandatory when token authentication is used. The token can be obtained by calling the IAM API used to obtain a user token. The value of X-Subject-Token in the response header is the user token. |
Authorization |
No |
String |
Authentication information. This parameter is mandatory for AK/SK authentication. |
X-Sdk-Date |
No |
String |
Time when a request is sent. This parameter is mandatory for AK/SK authentication. |
Response Parameters
Status code: 200
Parameter |
Parameter Type |
Description |
---|---|---|
sign_str |
String |
Signed string. Example: AWSAccessKeyId={AccessKeyID}&Expires={ExpiresValue}&Signature={Signature} |
Status code: 403
Parameter |
Parameter Type |
Description |
---|---|---|
error_code |
String |
Error code. |
error_msg |
String |
Error description. |
Request Examples
- Initialize an upload task:
GET https://{endpoint}/v1.0/{project_id}/asset/authority?http_verb=POST&content_type={type}&bucket={bucket}&object_key={objectKey}
- Upload parts:
GET https://{endpoint}/v1.0/{project_id}/asset/authority?http_verb=PUT&content_md5={md5}&part_number={num}&upload_id={id}&bucket={bucket}&object_key={objectKey}
- Merge parts:
GET https://{endpoint}/v1.0/{project_id}/asset/authority?http_verb=POST&upload_id={id}&bucket={bucket}&object_key={objectKey}
- Cancel a part:
GET https://{endpoint}/v1.0/{project_id}/asset/authority?http_verb=DELETE&bucket={bucket}&object_key={objectKey}&upload_id={uploadId}
- List uploaded parts:
GET https://{endpoint}/v1.0/{project_id}/asset/authority?http_verb=GET&bucket={bucket}&object_key={objectKey}&upload_id={uploadId}
Response Examples
Status code: 200
Returned when the request succeeded.
{ "sign_str" : "AWSAccessKeyId=UBWV*********N4NOJ&Expires=1730739600&Signature=47rXht3Qrd**********GiIxM40%3D" }
Status Codes
Status Code |
Description |
---|---|
200 |
Returned when the request succeeded. |
403 |
Returned when the request failed. |
Error Codes
See Error Codes.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot