Polyv Help Center

Help Center

Query Video Sync Task

Updated: 2025-01-14 15:45:08

API Description

1、分页查询账号下的视频同步任务详情
2、接口URL中的{userid}为点播账号userid,具体参考菜单【使用须知】->【获取密钥】
3、接口支持https协议

API URL

http://api.polyv.net/v2/video/grab/{userid}/list

Online API Call

Request Method

GET

API Constraints

  1. The API supports both HTTP and HTTPS. HTTPS is recommended for security. API calls have frequency limits. See details

Request Parameter Description

Parameter Required Type Description
ptime true Long Current time in milliseconds, valid for 3 minutes
sign true String Signature, a 40-character uppercase SHA1 value. The secretkey used to generate the signature is critical for communication data security. It must not be stored or used directly on the client side. All APIs must be called through the customer's own server to relay requests to the POLYV server for response data. See signature generation rules
page false Integer Page number, default is 1
pageSize false Integer Number of items per page, default is 10

Example

http://api.polyv.net/v2/video/grab/1b448be323/list?sign=B2F7F749B86C93514BDA9E56902B38D1514D0F9E&pageSize=2&page=1&ptime=1617154745507

Response Parameter Description

Parameter Type Description
code Integer Response status code. 200 indicates success, non-200 indicates failure. See global error description
status String Response status text
message String Response description. When code is 400 or 500, provides auxiliary error reason
data Object Returns sync task information on success See Data field description, returns empty on failure
Data Parameter Description
Field Type Description
pageNumber Integer Current page number
totalItems Integer Total number of items
contents Array Query result list See Contents field description
firstPage Boolean Whether it is the first page, value: true/false
lastPage Boolean Whether it is the last page, value: true/false
nextPageNumber Integer Next page number
prePageNumber Integer Previous page number
totalPages Integer Total number of pages
startRow Integer Position of the first record on the current page in the total sync records
endRow Integer Position of the last record on the current page in the total sync records
limit Integer Number of sync task records on the current page
offset Integer Pagination starting record
Contents Parameter Description
Field Type Description
taskid String Sync task ID
userid String POLYV VOD account ID
originalname String Title of the uploaded sync task CSV file
fileurl String URL of the sync task CSV file
classifyid Integer Category ID uploaded to VOD
classifyname String Category name
seccesscount Integer Number of successful sync tasks
totalcount Integer Total number of syncs in this task
failcount Integer Number of failed sync tasks
status String Sync task status
Y: Started
N: Paused
endtime Long Task completion time, 13-digit millisecond timestamp
createtime Long Task creation time, 13-digit millisecond timestamp

Java Request Example

For quick integration of basic code, download the relevant dependency source code. Click to download source code. After downloading, add it to your own source project. The test cases include HttpUtil.java and VodSignUtil.java in the downloaded file.

It is strongly recommended to use the VOD Java SDK for API integration. The VOD Java SDK provides unified encapsulation and optimization for API call logic, exception handling, data signing, and HTTP request thread pools.

private static final Logger log = LoggerFactory.getLogger(VodVideoUploadTest.class);
/**
 * 查询视频同步任务
 */
@Test
public void testGetVideoSyncTask() throws Exception, NoSuchAlgorithmException {
    //公共参数,填写自己的实际参数
    String secretKey = super.secretKey;
    String userid = super.userId;
    String ptime = String.valueOf(System.currentTimeMillis());
    //业务参数
    String url = String.format("http://api.polyv.net/v2/video/grab/%s/list",userid);
    String page = "1";
    String pageSize =  "2";

    Map<String, String> requestMap = new HashMap<>();
    requestMap.put("ptime", ptime);
    requestMap.put("page", page);
    requestMap.put("pageSize", pageSize);
    requestMap.put("sign", VodSignUtil.getSign(requestMap, secretKey));
    
    String response = HttpUtil.get(url, requestMap);
    log.debug("测试查询视频同步任务详情,{}", response);
    //do somethings

}

Response Example

For global system error descriptions, see Global Error Description

Success Example

{
    "code": 200,
    "status": "success",
    "message": "",
    "data": {
        "pageNumber": 1,
        "totalItems": 2,
        "contents": [{
            "taskid": "0mKdBQDsbR",
            "userid": "1b448be323",
            "filename": null,
            "originalname": "批量同步任务",
            "filesize": null,
            "filepath": null,
            "fileurl": "",
            "classifyid": null,
            "classifyname": null,
            "seccesscount": 2,
            "totalcount": 2,
            "failcount": 0,
            "status": "Y",
            "endtime": 1617096051000,
            "createtime": 1617095853000,
            "param1": null,
            "param2": null,
            "callbackurl": ""
        }, {
            "taskid": "QQf4rRojYq",
            "userid": "1b448be323",
            "filename": null,
            "originalname": "批量同步任务",
            "filesize": null,
            "filepath": null,
            "fileurl": "",
            "classifyid": null,
            "classifyname": null,
            "seccesscount": 1,
            "totalcount": 1,
            "failcount": 0,
            "status": "Y",
            "endtime": 1617093860000,
            "createtime": 1617093668000,
            "param1": null,
            "param2": null,
            "callbackurl": ""
        }],
        "lastPage": true,
        "firstPage": true,
        "startRow": 1,
        "nextPageNumber": 1,
        "prePageNumber": 1,
        "totalPages": 1,
        "endRow": 2,
        "limit": 2,
        "offset": 0
    }
} 

Error Example

{
  "code":400,
  "status":"error",
  "message":"TaskId is null!",
  "data":""
}
联系客服,在线咨询