Modify Global Callback Settings
API Description
1、修改全局回调设置
2、(timestamp, appId)参与sign签名,并和sign一起通过url传递,请求体参数不参与签名,通过post请求体传递【请设置请求头contentType:application/json】
3、接口支持https协议
API URL
http://api.polyv.net/live/v4/user/global-setting/callback/update
Request Method
POST
API Constraints
The API supports both HTTP and HTTPS. HTTPS is recommended for security. API calls have frequency limits. See details
The submitted callback URL must start with http:// or https://
Request Parameter Description
| Parameter | Required | Type | Description |
|---|---|---|---|
| appId | true | String | Account appId See Get Secret Key |
| timestamp | true | Long | Current 13-digit millisecond timestamp, valid for 3 minutes |
| sign | true | String | Signature, a 32-character uppercase MD5 value. The appSecret key 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 |
Request Body Parameter Description
| Parameter | Required | Type | Description |
|---|---|---|---|
| recordCallbackUrl | false | String | Recording generation callback URL |
| recordFileCallBackType | false | String | Callback recording file content all: All playback videos last: Final playback video |
| recordCallbackVideoType | false | String | Callback file type m3u8: m3u8 file mp4: mp4 file m3u8,mp4: m3u8 and mp4 files |
| playbackCallbackUrl | false | String | Transfer success callback URL |
| rebirthVodCallbackEnabled | false | String | Remake courseware transfer VOD callback switch Y: Enable N: Disable |
| pptRecordCallbackUrl | false | String | Courseware remake success callback URL |
| streamCallbackUrl | false | String | Live stream status change callback URL |
| channelBasicUpdateCallbackUrl | false | String | Channel live room info modification callback URL |
| liveScanCallbackUrl | false | String | Live content review failure callback URL |
| playbackCacheCallbackUrl | false | String | Live playback cache generation callback notification URL |
| aiPptVideoCallbackUrl | false | String | Video creation info callback |
| liveViolationCutoffCallbackUrl | false | String | Live violation stream cutoff callback |
| liveStatsCallbackUrl | false | String | Live data statistics info callback |
Example
http://api.polyv.net/live/v4/user/global-setting/callback/update?appId=frlr1zazn3&sign=1C6F581887B59B388325338DA850330D×tamp=1657852824050
Request body parameters:
{
"rebirthVodCallbackEnabled": "Y",
"recordCallbackUrl": "https://www.abc.com/callback1",
"streamCallbackUrl": "https://www.abc.com/callback3",
"recordFileCallBackType": "last",
"recordCallbackVideoType": "m3u8",
"playbackCallbackUrl": "https://www.abc.com/callback2",
"aiPptVideoCallbackUrl":"https://www.abc.com/callback4"
"liveViolationCutoffCallbackUrl":"https://www.abc.com/callback4"
}
Response Parameter Description
| Parameter | Type | Description |
|---|---|---|
| code | Integer | Status code, same as HTTP status code, used to determine basic response status |
| status | String | Response result, determined by business logic. Returns success on success, error on failure |
| success | Boolean | Whether the response was successful |
| requestId | String | Request ID, a unique UUID generated for each request. Only for troubleshooting and debugging, should not be tied to business logic |
| error | Object | Error information when status code is not 200 See Error Field Description |
| data | Boolean | Returns true on success |
Error Parameter Description
| Parameter | Type | Description |
|---|---|---|
| code | Integer | Error code, used to determine the specific error cause |
| desc | String | Error description, corresponds to error.code |
Java Request Example
For quick integration of basic code, please download the relevant dependency source code. Click here to download the source code. After downloading, add it to your own source project. HttpUtil.java and LiveSignUtil.java in the test cases are included in the download file.
It is strongly recommended to use the Live Java SDK for API integration. The Live 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(UserTest.class);
/**
* 修改全局回调设置
* @throws IOException
* @throws NoSuchAlgorithmException
*/
@Test
public void updateCallbackTest() throws IOException, NoSuchAlgorithmException {
//公共参数,填写自己的实际参数
String appId = super.appId;
String appSecret = super.appSecret;
String timestamp = String.valueOf(System.currentTimeMillis());
//业务参数
String url = "http://api.polyv.net/live/v4/user/global-setting/callback/update";
String recordCallbackUrl = "https://www.abc.com/callback1";
String recordFileCallBackType = "last";
String recordCallbackVideoType = "m3u8";
String playbackCallbackUrl = "https://www.abc.com/callback2";
String rebirthVodCallbackEnabled = "Y";
String streamCallbackUrl = "https://www.abc.com/callback3";
String aiPptVideoCallbackUrl = "https://www.abc.com/callback4";
String liveViolationCutoffCallbackUrl = "https://www.abc.com/callback4";
//http 调用逻辑
Map<String, String> requestMap = new HashMap<>();
requestMap.put("appId", appId);
requestMap.put("timestamp", timestamp);
Map<String, Object> jsonMap = new HashMap<>();
jsonMap.put("recordCallbackUrl", recordCallbackUrl);
jsonMap.put("recordFileCallBackType", recordFileCallBackType);
jsonMap.put("recordCallbackVideoType", recordCallbackVideoType);
jsonMap.put("playbackCallbackUrl", playbackCallbackUrl);
jsonMap.put("rebirthVodCallbackEnabled", rebirthVodCallbackEnabled);
jsonMap.put("streamCallbackUrl", streamCallbackUrl);
jsonMap.put("aiPptVideoCallbackUrl", aiPptVideoCallbackUrl);
jsonMap.put("liveViolationCutoffCallbackUrl", liveViolationCutoffCallbackUrl);
requestMap.put("sign", LiveSignUtil.getSign(requestMap, appSecret));
url = HttpUtil.appendUrl(url, requestMap);
String response = HttpUtil.postJsonBody(url, JSON.toJSONString(jsonMap), null);
log.info("测试修改全局回调设置成功:{}", response);
//do somethings
}
Response Example
For system-wide error descriptions, see Global Error Description
Success Example
{
"code": 200,
"status": "success",
"requestId": "8acd0194a7b6459a8ab168fcf2b63153.69.16578528273261669",
"data": true,
"success": true
}
Error Example
{
"code": 400,
"status": "error",
"requestId": "d310b70bc329403f87f77f9203d50f89.128.16360831552223589",
"error": {
"code": 20001,
"desc": "application not found."
},
"success": false
}
