Updates a video
Function
After a media file is created, upload a thumbnail, update a video file, or update the existing thumbnail.After a video file is updated, call the API for Confirming Media Upload to notify VOD.You do not need to call the API after updating or uploading a thumbnail.You can upload an updated video by part. For details, see Example 2: Uploading a Media File More Than 20 MB by Part.
Constraints
The video update API can be used to update only media assets that fail to be downloaded or uploaded, or whose upload has been canceled.
Rules for configuring parameters in the request body:
-
Configure at least one of the following parameters: video_name, cover_type, and subtitles.
-
To update a video, video_name and video_type must be specified.
-
To update a thumbnail, cover_type is mandatory and cannot be left empty. If cover_id is specified, the value must be 0.
-
To upload a subtitle file, the id, type, and language of subtitles must be specified.
If the parameters are not specified as instructed, API response will fail.
URI
PUT /v1.0/{project_id}/asset
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
project_id |
Yes |
String |
Project ID. For details about how to obtain the project ID, see Obtaining a Project ID. |
Request Parameters
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
X-Auth-Token |
No |
String |
User token. This parameter is mandatory when token authentication is used. It 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 a token. |
Authorization |
No |
String |
Authentication information. This parameter is mandatory for AK/SK authentication. |
X-Sdk-Date |
No |
String |
Time when the request is sent. This parameter is mandatory for AK/SK authentication. |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
asset_id |
Yes |
String |
Media asset ID assigned by VOD. This parameter can only be queried but cannot be modified. |
video_md5 |
No |
String |
MD5 value of a video fileYou are advised to refer to the example of uploading and updating media files in Generating an MD5 Value in the appendix of API Reference. |
video_name |
No |
String |
Video file name The file name extension is optional. |
video_type |
No |
String |
Video file type The value can be MP4, TS, MOV, MXF, MPG, FLV, WMV, AVI, M4V, F4V, MPEG, 3GP, ASF, or MKV. |
cover_id |
No |
Integer |
Thumbnail ID The value ranges from 0 to 7. Currently, only one thumbnail is supported. Therefore, this parameter must be set to 0. |
cover_type |
No |
String |
Thumbnail image format Possible values are:
|
cover_md5 |
No |
String |
MD5 value of the cover file |
subtitles |
No |
Array of Subtitle objects |
Subtitle file information |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
id |
Yes |
Integer |
Subtitle ID. The value ranges from 1 to 16. |
type |
Yes |
String |
Subtitle file format. Currently, only SRT and VTT are supported. |
language |
Yes |
String |
Subtitle language. |
name |
No |
String |
Subtitle file name. |
md5 |
No |
String |
MD5 value of the subtitle file |
description |
No |
String |
Subtitle description |
Response Parameters
Status code: 200
Parameter |
Type |
Description |
---|---|---|
asset_id |
String |
Media asset ID assigned by VOD. This parameter can only be queried but cannot be modified. |
video_upload_url |
String |
URL for uploading video files This API is called by the client to upload a small video file not greater than 20 MB. The URL contains temporary authorization information. If the file size is greater than 20 MB, the file needs to be uploaded in multipart mode.
NOTE:
You can use PUT requests to upload video files to video_upload_url. Configure Content-Type according to the type of the video file to be uploaded. The value is in the format of video/video format, for example, video/mp4. |
cover_upload_url |
String |
URL for uploading thumbnail files
NOTE:
You can use PUT requests to upload thumbnail images to cover_upload_url. Configure Content-Type according to the type of the thumbnail file to be uploaded. The value is in the format of image/image format, for example, image/png. |
subtitle_upload_urls |
Array of strings |
URL for uploading subtitles
NOTE:
You can use PUT requests to upload subtitle files to subtitle_upload_urls. Configure Content-Type according to the type of the subtitle file to be uploaded. For example, the value can be application/octet-stream. |
Status code: 403
Parameter |
Type |
Description |
---|---|---|
error_code |
String |
Error code |
error_msg |
String |
Error description |
Example Requests
Updates a media file.
PUT https://{endpoint}/v1.0/{project_id}/asset Content-Type: application/json { "asset_id": "f488337c31c8e4622f1590735b134c65", "cover_id": "0", "cover_type": "JPG", "subtitles": [ { "id": 1, "language": "CN", "type": "SRT", "md5": "SqcyFjJZoDZaP8oKIY6rgQ==", "description": "AAAAA" } ] }
Example Responses
Status code: 200
The information is returned when the request succeeds.
{ "asset_id" : "f488337c31c8e4622f1590735b134c65", "cover_upload_url" : "https://obs.cn-north-4.myhuaweicloud.com:443/obs-vod-1/%7Bproject_id%7D/f488337c31c8e4622f1590735b134c65/cover/Cover0.jpg?AWSAccessKeyId=CBN2J**********0RCSN&Expires=1518148410&Signature=kZYh0hEos2V**********AHGyXA%3D", "subtitle_upload_urls" : [ "https://obs-vod-1.obs.cn-north-4.myhuaweicloud.com:443/14ce1d4437164aba8b364ce15866154e/53a018d2dc53ca07eb5a07a839205c9d/subtitle/1.srt?AWSAccessKeyId=CBN2J**********0RCSN&Expires=1534760131&Signature=kZYh0hEos2V**********AHGyXA%3D" ] }
Status code: 403
The information is returned when the request fails.
{ "error_code" : "VOD.10062", "error_msg" : "Media asset or resource does not exist, please check." }
Status Codes
Status Code |
Description |
---|---|
200 |
The information is returned when the request succeeds. |
403 |
The information is returned when the request fails. |
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