Upload Video Cover Image
Updated: 2022-05-23 19:02:59
Interface URL
http://api.polyv.net/v2/video/upload-cover-image
Interface Description
Upload video cover image
Supported Format
JSON
Request Method
POST
Request Parameters
| Parameter | Required | Type & Range | Description |
|---|---|---|---|
| userid | Yes | string | User ID |
| ptime | Yes | long | Current time in milliseconds (13 digits), valid for 3 minutes |
| sign | Yes | String | Signature, 40-character uppercase SHA1 value [See Signature Generation Rules] |
| vids | No | string | Video ID(s), multiple IDs separated by commas |
| cateIds | No | string | Category ID(s), multiple IDs separated by commas |
| imageFile | No | file | Image binary data |
| imageUrl | No | string | Image HTTP URL |
| imageBase64 | No | string | Base64-encoded image data, must include the corresponding type, e.g., data:image/jpg;base64,VBORw0KGgoAAAANSUhEUgAABGwAAAJ3CAYAAADBMcc+AAAAAXNSR0IArs4c6QAAAARnQU1BAACx |
Parameter Notes:
vids, cateIds: When the vids parameter is provided, vids takes precedence. When vids is not provided, cateIds is used. Both parameters cannot be empty simultaneously. imageFile, imageUrl, imageBase64: Image upload methods, choose any one. If multiple are provided, the first non-empty method is selected in the order imageFile, imageUrl, imageBase64. Note: Only png, jpg, jpeg, gif, bmp image formats are supported, and the image size must not exceed 5MB.
Example of Successful JSON Response
{
"code": 200,
"status": "success",
"message": "success",
"data": {
"imageUrlSmall": "http://img.videocc.net/uimage/a/a2dc4f2517/first_image/a5bdfab0-43f6-466f-b4b5-c7b54c03277d_s.png",
"imageUrlBig": "http://img.videocc.net/uimage/a/a2dc4f2517/first_image/a5bdfab0-43f6-466f-b4b5-c7b54c03277d_b.png"
}
}
Example of Error JSON Response
签名不正确
{
"code":400,
"status":"error",
"message":"the sign is not right",
"data":""
}
时间戳过期
{
"code":400,
"status":"error",
"message":"ptime is too old.",
"data":""
}
内部错误,或传了非法参数程序转换异常
{
"code": 500,
"status": "fail",
"message": "undefined error",
"data": null
}
Field Description
| Field | Description |
|---|---|
| code | Return code |
| status | Return status |
| message | Return message |
| data | Operation result |
| imageUrlSmall | Small image URL |
| imageUrlBig | Large image URL |
Java Request Example:
public void testUploadCoverImage() throws Exception {
String url = "http://api.polyv.net/v2/video/upload-cover-image";
Map<String, String> params = new HashMap<>();
params.put("userid", userid);
params.put("vids", "a2dc4f25172872650e7d5c1b8026b13c_a");
params.put("imageUrl", "https://s1-test.videocc.net/reg-login/img/4477595.png");
params.put("ptime", String.valueOf(System.currentTimeMillis()));
params.put("sign", getSign(params, secretkey));
String response = HttpClientUtil.getInstance().sendHttpPost(url, params);
System.out.println(response);
}
