This topic describes how to call the CreateKeyword operation to add 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.

Request parameters

For more information about the common request parameters that must be included in all Content Moderation API requests, see Common request parameters.

The following table describes the parameters in the request body.
Parameter Type Required Description
KeywordLibId Numeric Yes The primary key ID of the text library.
Keywords String Yes The terms to add.

Response parameters

For more information about common response parameters that this operation returns, see Common response parameters.
Parameter Type Required Description
SuccessCount Numeric Yes The number of terms that have been added.
InvalidKeywordList String Yes The invalid terms, that is, the terms that failed to be added.

Examples

Sample requests
{
  "KeywordLibId": "2147",
  "Keywords": [test]
}
Sample success responses
{
  "code": 200,
  "data": {
    "InvalidKeywordList": [
      "test"
    ],
    "SuccessCount": 0
  }
}