CreateKeyword

更新时间:
复制 MD 格式

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.

ParameterTypeRequiredExampleDescription
KeywordLibIdIntegerYes2147The primary key ID of the keyword library.
KeywordsStringArrayYes["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.

ParameterTypeExampleDescription
SuccessCountInteger0The number of keywords successfully added.
InvalidKeywordListStringArray["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
  }
}