Adds keywords to a custom keyword library for text anti-spam moderation.
Operation description
The effect of managing custom keyword libraries by calling API operations is the same as managing them in the Alibaba Cloud AI Guardrails console.
For information about how to construct an HTTP request, see Create a request. You can also use an SDK. For more information, see SDK overview.
Billing: Free of charge.
QPS limits
Up to 10 calls per second per account. Exceeding this limit triggers throttling, which may affect your service. We recommend that you take note of the limit when you call this operation.
Request parameters
For common request parameters required in all AI Guardrails API requests, see Common parameters.
The following table describes the parameters in the request body.
| Parameter | Type | Required | Example | Description |
|---|---|---|---|---|
| KeywordLibId | Integer | Yes | 2147 | The primary key ID of the keyword library. |
| Keywords | StringArray | Yes | ["test"] | The keywords to add. You can add up to 3,000 keywords per call. |
Response parameters
For common response parameters, see Common response parameters.
| Parameter | Type | Example | Description |
|---|---|---|---|
| SuccessCount | Integer | 0 | The number of keywords successfully added. |
| InvalidKeywordList | StringArray | ["test"] | The keywords that failed to be added. |
Examples
Sample request
http(s)://green.cn-shanghai.aliyuncs.com/?Action=CreateKeyword&ServiceModule=open_api
&<Common request parameters>
{
"KeywordLibId": 2147,
"Keywords": [
"test"
]
}Sample response
{
"code": 200,
"data": {
"InvalidKeywordList": [
"test"
],
"SuccessCount": 0
}
}