Polyv Help Center

Help Center

Query WeChat Sharing Settings Information

Updated: 2025-01-14 16:03:21

API Description

1、通过视频id查询微信分享页的视频相关信息
2、接口URL中的{userid}为点播账号userid,具体参考菜单【使用须知】->【获取密钥】
3、接口支持https协议

API URL

http://api.polyv.net/v2/video/wechat-share/{userid}/video-info

Online API Call

Request Method

GET

API Constraints

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

Request Parameter Description

Parameter Required Type Description
ptime true Long Current time in milliseconds, valid within 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 never be saved 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 and obtain response data. See signature generation rules
vid true String Video ID

Example

http://api.polyv.net/v2/video/wechat-share/1b448be323/video-info?vid=1b448be323cc23bef70fee7d077f00df_1&sign=CC5243101369C74FC1899577F30ED04A72A983A4&ptime=1617245387622

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 additional error details
data Object Returns video-related information for the WeChat sharing page on success, or empty on failure. See data field description

Data Field Description

Parameter Type Description
videoCoverImg String Video cover image
videoTitle String Video WeChat sharing title (first 30 characters)
fullVideoTitle String Full video WeChat sharing title
videoDesc String Video description
videoIcon String Video icon
originalPlayTimes Integer Initial play count
originalLikeNum Integer Initial like count
Error Code List
Error Code Message Description
400 sign can not be empty. Signature is empty
400 ptime is too old. Timestamp has expired
400 ptime is illegal. Timestamp format is invalid or exceeds 3 minutes from current time
400 Could not find user by userid. User ID does not exist
400 the sign is not right. Signature is incorrect
401 vid is blank. Video ID is empty
402 cannot find the video. Video not found
500 get video info failed. Backend query error

Java Request Example

For quick integration, please download the relevant dependency source code. Click here to download the source code. Add it to your project after downloading. 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(VodVideoWechatShareTest.class);
/**
 * 查询微信分享设置信息
 */
@Test
public void testGetWechatShareSetting() throws Exception, NoSuchAlgorithmException {
    //公共参数,填写自己的实际参数
    String secretKey = super.secretKey;
    String userId = super.userId;
    String ptime = String.valueOf(System.currentTimeMillis());
    //业务参数
    String url = "http://api.polyv.net/v2/video/wechat-share/" + userId + "/video-info";
    String vid =  "1b448be323cc23bef70fee7d077f00df_1";

    Map<String, String> requestMap = new HashMap<>();
    requestMap.put("ptime", ptime);
    requestMap.put("vid", vid);
    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": "success",
    "data": {
        "videoDesc": "",
        "originalPlayTimes": 0,
        "videoCoverImg": "http://img.videocc.net/uimage/1/1b448be323/f/1b448be323cc23bef70fee7d077f00df_0.jpg",
        "videoIcon": "http://my.polyv.net/assets/images/video-default.png",
        "videoTitle": "测试视频标题",
        "fullVideoTitle": "测试完整标题",
        "originalLikeNum": 0
    }
}

Error Example

 {
    "code": 400,
    "status": "error",
    "message": "ptime is too old.",
    "data": ""
}
联系客服,在线咨询
在线咨询