Creates a custom text library. You can use text libraries for text anti-spam. The effect of managing custom text libraries by calling API operations is the same as that of managing custom text libraries in the Alibaba Cloud Content Moderation console.
Description
Operation: CreateKeywordLib
You can call this operation to create a text library. For more information about how to construct an HTTP request, see Request structure. You can also select an existing HTTP request. For more information, see SDK overview.
- Text anti-spam: detects text violations.
- Ad violation detection: detects ads or illegal text in images.
- Audio anti-spam: detects audio violations.
You can also create a text library in the Alibaba Cloud Content Moderation console. For more information, see Manage custom text libraries.
Billing: This operation is free of charge.
QPS limit
You can send up to 10 requests per second to call this operation by using your Alibaba Cloud account. If you send an excessive number of requests, throttling is implemented, and your business may be affected.
Request parameters
For more information about the common request parameters that must be included in all Content Moderation API requests, see Common parameters.
Parameter | Type | Required | Example | Description |
---|---|---|---|---|
ServiceModule | String | Yes | open_api |
The name of the service module. Set the value to open_api. |
Name | String | Yes | test1sdkdk | The name of the text library. |
ResourceType | String | Yes | TEXT | The moderation scenario to which the text library applies. Valid values:
|
BizTypes | StringArray | No | ["bizTypeA","bizTypeB"] | The business scenario. For more information, see CreateBizType. |
Category | String | Yes | BLACK | The category of the text library. Valid values:
|
LibType | String | Yes | textKeyword | The category of the text library in each moderation scenario. Valid values:
|
MatchMode | String | No | fuzzy | The matching method. Valid values:
|
Enable | Boolean | No | true | Specifies whether to enable text library.
|
Response parameters
Parameter | Type | Example | Description |
---|---|---|---|
code | Integer | 200 | The returned HTTP status code.
For more information, see Common HTTP status codes. |
msg | String | OK | The message that is returned for the request. |
requestId | String | 795D8871-4889-4C0F-A8B1-C7D2B990FF61 | The unique ID of the request, which can be used to locate issues. |
id | String | 123 | The unique ID of the text library, which can be used to perform subsequent operations on the text library. |
Examples
http(s)://green.cn-shanghai.aliyuncs.com/?
Action=CreateKeywordLib&ServiceModule=open_api
&<Common request parameters>
{
"Name": "test1sdkdk",
"BizTypes": [],
"Category": "BLACK",
"ServiceModule": "open_api",
"ResourceType": "TEXT",
"LibType": "textKeyword"
}
{
"RequestId": "795D8871-4889-4C0F-A8B1-C7D2B990FF61",
"code": 200,
"Id": "123"
}