Adds terms to a specified 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: CreateKeyword

You can call this operation to add terms to a specified text library. For more information about how to construct an HTTP request, see Construct a request. You can also select an existing HTTP request. For more information, see SDK overview.

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.

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 text library.
Keywords StringArray Yes ["test"] The list of terms. You can add up to 3,000 terms at a time.

Response parameters

For more information about common response parameters that this operation returns, see Common response parameters.
Parameter Type Example Description
SuccessCount Integer 0 The number of terms that are added.
InvalidKeywordList StringArray ["test"] The list of the terms that failed to be added.

Examples

Sample requests
http(s)://green.cn-shanghai.aliyuncs.com/?
Action=CreateKeyword&ServiceModule=open_api
&<Common request parameters>
{
  "KeywordLibId": 2147,
  "Keywords": [
      "test"
  ]
}
Sample responses
{
  "code": 200,
  "data": {
    "InvalidKeywordList": [
      "test"
    ],
    "SuccessCount": 0
  }
}