This topic describes how to call the CreateKeywordLib operation to create 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. The created text library can be used for text anti-spam.
Request parameters
For more information about the common request parameters that must be included in all Content Moderation API requests, see Common request parameters.
Parameter | Type | Required | Description |
---|---|---|---|
ServiceModule | String | Yes | The name of the service module to which the text library is applied. Valid value: open_api (indicates the Content Moderation API). |
Name | String | Yes | The name of the text library. |
ResourceType | String | Yes | The resource type of the text library. Valid values:
|
BizTypes | List | No | The business type of the custom text library that you set on the Moderation Policy tab (by choosing Settings > Moderation API). |
Category | String | Yes | The category of the text library. Valid values:
|
LibType | String | Yes | The type of the text library in each moderation scenario. Valid values:
|
MatchMode | String | No | The matching method. Valid values:
|
Enable | Boolean | No | Specifies whether to enable the text library. A value of true indicates that the text library is enabled, and a value of false indicates that the text library is disabled. |
Response parameters
Parameter | Type | Required | Description |
---|---|---|---|
code | Integer | Yes | The error code. Most error codes are consistent with HTTP status codes, and some error
codes are extended.
|
msg | String | No | The description of the call error. |
requestId | String | Yes | The unique ID of the request, which can be used to locate issues. |
id | String | Yes | The unique ID of the text library, which can be used to perform subsequent operations on the text library. |
Examples
{
"Name": "test1sdkdk",
"BizTypes": [],
"Category": "BLACK",
"ServiceModule": "open_api",
"ResourceType": "TEXT",
"LibType": "textKeyword"
}
{
"RequestId": "795D8871-4889-4C0F-A8B1-C7D2B990FF61",
"code": 200,
"Id":123
}