Query Audio Moderation Glossary
Interface Description
1、分页查询账号的音频审核词库(敏感词或严禁词),词库为账号级配置,账号下所有频道共用同一份词库
2、管理后台和开放API读写同一份词库,任一入口保存成功后,另一入口查询到相同结果
3、接口支持https协议
Interface URL
http://api.polyv.net/live/v4/user/audio-moderation/word/list
Request Method
GET
Interface Constraints
The interface supports both HTTP and HTTPS. HTTPS is recommended for security. API calls have frequency limits. See details
The audio moderation feature must be enabled. If not enabled, error code
1041is returned. The interface determines the target account based onappIdin the signature and does not accept user IDs or channel numbers.
Request Parameter Description
| Parameter | Required | Type | Description |
|---|---|---|---|
| appId | true | String | Account appId See details on obtaining keys |
| 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 used directly on the client side. All APIs must be called through your own server to relay requests to the POLYV server for response data. See signature generation rules |
| wordType | true | String | Word type keyword: Sensitive word badword: Prohibited word |
| pageNumber | false | Integer | Page number, starting from 1, default is 1 |
| pageSize | false | Integer | Items per page, 1-100, default is 20 |
Example
http://api.polyv.net/live/v4/user/audio-moderation/word/list?appId=frlr1zazn3&sign=49428741C1D7BEE8BE1EE545F066ECC7×tamp=1677167340447&wordType=keyword&pageNumber=1&pageSize=20
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, not to be tied to business logic |
| error | Object | Error information when status code is not 200 See Error parameter description |
| data | Object | Data on successful response See data parameter description |
Error Parameter Description
| Parameter | Type | Description |
|---|---|---|
| code | Integer | Error code, used to determine the specific error cause, e.g., 1041 indicates the account has not enabled audio moderation |
| desc | String | Error description, corresponding to error.code |
Data Parameter Description
| Parameter | Type | Description |
|---|---|---|
| wordType | String | Word type for this query keyword: Sensitive word badword: Prohibited word |
| pageNumber | Integer | Current page number |
| pageSize | Integer | Items per page |
| totalItems | Long | Total number of words in the current category. Each account can store up to 5000 sensitive words and 5000 prohibited words |
| totalPages | Long | Total number of pages |
| contents | Array | Words on the current page |
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 LiveSignUtil.java, both contained 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(getClass());
/**
* 查询音频审核词库
* @throws IOException
* @throws NoSuchAlgorithmException
*/
@Test
public void testAudioModerationWordList() 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/audio-moderation/word/list";
String wordType = "keyword";
Integer pageNumber = 1;
Integer pageSize = 20;
//http 调用逻辑
Map<String, String> requestMap = new HashMap<>();
requestMap.put("appId", appId);
requestMap.put("timestamp", timestamp);
requestMap.put("wordType", wordType);
requestMap.put("pageNumber", String.valueOf(pageNumber));
requestMap.put("pageSize", String.valueOf(pageSize));
requestMap.put("sign", LiveSignUtil.getSign(requestMap, appSecret));
String response = HttpUtil.get(url, requestMap);
log.info("测试查询音频审核词库,返回值:{}", response);
//do somethings
}
Response Example
For global system error descriptions, see Global Error Description
Success Example
{
"code": 200,
"status": "success",
"requestId": "414afeb28f1c4f0ca17e1c3c1e39d247.71.16771673423081591",
"data": {
"wordType": "keyword",
"pageNumber": 1,
"pageSize": 20,
"totalItems": 2,
"totalPages": 1,
"contents": [
"示例敏感词一",
"示例敏感词二"
]
},
"success": true
}
Error Example
{
"code": 400,
"status": "error",
"requestId": "d310b70bc329403f87f77f9203d50f89.128.16360831552223589",
"error": {
"code": 1041,
"desc": "audio moderation is not enabled."
},
"success": false
}
