Batch Get VOD Video Completion Rate
Updated: 2022-05-16 10:08:41
Interface URL
https://api.polyv.net/v2/video/engagement/{userId}/getList
Interface Description
Supports batch paginated retrieval of video watch completion rates
Supports https
JSON
Request Method
POST, GET
Request Limit
TRUE
Request Parameters
Return Result
{
"code": 200,
"status": "success",
"message": "success",
"data": {
"pageSize": 20,
"pageNumber": 1,
"totalItems": 1,
"contents": [
{
"vid": "ee7fe7fbdadafe381e8e100669144e51_e",
"viewerId": "1111",
"watchPercentage": 0.05
}
]
}
}
Example JSON for Failed Request
// 签名错误
{
"code": 400,
"status": "error",
"message": "the sign is not right.",
"data": ""
}
// 类型错误
{
"code": 400,
"status": "error",
"message": "field type error",
"data": ""
}
// ...
Field Description
Java Example Code
public class Test {
public static void main(String[] args) throws Exception {
String userId = "ee7fe7fbda";
String secretkey = "2owGBAZsAY";
String url = "https://api.polyv.net/v2/video/engagement/%s/getList";
Map<String, String> maps = new HashMap<>();
maps.put("field", "viewer");
maps.put("fieldValue", "1111");
maps.put("filterValue", "");
maps.put("sign", getSign(maps, secretkey));
url += "?" + buildUrl(maps);
url = String.format(url, userId);
HttpClient client = new HttpClient();
GetMethod getMethod = new GetMethod(url);
client.executeMethod(getMethod);
System.out.println(url);
System.out.println(getMethod.getResponseBodyAsString());
}
public static String buildUrl(Map<String, String> maps) {
List<String> tmp = new ArrayList<>();
for (Map.Entry<String, String> key : maps.entrySet()) {
tmp.add(key.getKey() + "=" + key.getValue());
}
return String.join("&", tmp);
}
}