JavaScript
import ModerationAPI from '@moderation-api/sdk';
const client = new ModerationAPI({
secretKey: process.env['MODAPI_SECRET_KEY'], // This is the default and can be omitted
});
const response = await client.wordlist.words.add('id', { words: ['string'] });
console.log(response.addedCount);import os
from moderation_api import ModerationAPI
client = ModerationAPI(
secret_key=os.environ.get("MODAPI_SECRET_KEY"), # This is the default and can be omitted
)
response = client.wordlist.words.add(
id="id",
words=["string"],
)
print(response.added_count)require "moderation_api"
moderation_api = ModerationAPI::Client.new(secret_key: "My Secret Key")
response = moderation_api.wordlist.words.add("id", words: ["string"])
puts(response)<?php
require_once dirname(__DIR__) . '/vendor/autoload.php';
use ModerationAPI\Client;
use ModerationAPI\Core\Exceptions\APIException;
$client = new Client(secretKey: getenv('MODAPI_SECRET_KEY') ?: 'My Secret Key');
try {
$response = $client->wordlist->words->add('id', words: ['string']);
var_dump($response);
} catch (APIException $e) {
echo $e->getMessage();
}using System;
using ModerationApi;
using ModerationApi.Models.Wordlist.Words;
ModerationApiClient client = new();
WordAddParams parameters = new()
{
ID = "id",
Words =
[
"string"
],
};
var response = await client.Wordlist.Words.Add(parameters);
Console.WriteLine(response);{
"addedCount": 123,
"totalCount": 123,
"addedWords": [
"<string>"
]
}{
"code": "BAD_REQUEST",
"message": "Invalid input data",
"issues": []
}{
"code": "UNAUTHORIZED",
"message": "Authorization not provided",
"issues": []
}{
"code": "NOT_FOUND",
"message": "Not found",
"issues": []
}Add words to wordlist
Add words to an existing wordlist
JavaScript
import ModerationAPI from '@moderation-api/sdk';
const client = new ModerationAPI({
secretKey: process.env['MODAPI_SECRET_KEY'], // This is the default and can be omitted
});
const response = await client.wordlist.words.add('id', { words: ['string'] });
console.log(response.addedCount);import os
from moderation_api import ModerationAPI
client = ModerationAPI(
secret_key=os.environ.get("MODAPI_SECRET_KEY"), # This is the default and can be omitted
)
response = client.wordlist.words.add(
id="id",
words=["string"],
)
print(response.added_count)require "moderation_api"
moderation_api = ModerationAPI::Client.new(secret_key: "My Secret Key")
response = moderation_api.wordlist.words.add("id", words: ["string"])
puts(response)<?php
require_once dirname(__DIR__) . '/vendor/autoload.php';
use ModerationAPI\Client;
use ModerationAPI\Core\Exceptions\APIException;
$client = new Client(secretKey: getenv('MODAPI_SECRET_KEY') ?: 'My Secret Key');
try {
$response = $client->wordlist->words->add('id', words: ['string']);
var_dump($response);
} catch (APIException $e) {
echo $e->getMessage();
}using System;
using ModerationApi;
using ModerationApi.Models.Wordlist.Words;
ModerationApiClient client = new();
WordAddParams parameters = new()
{
ID = "id",
Words =
[
"string"
],
};
var response = await client.Wordlist.Words.Add(parameters);
Console.WriteLine(response);{
"addedCount": 123,
"totalCount": 123,
"addedWords": [
"<string>"
]
}{
"code": "BAD_REQUEST",
"message": "Invalid input data",
"issues": []
}{
"code": "UNAUTHORIZED",
"message": "Authorization not provided",
"issues": []
}{
"code": "NOT_FOUND",
"message": "Not found",
"issues": []
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Path Parameters
ID of the wordlist to add words to
Body
application/json
Array of words to add to the wordlist. Duplicate words will be ignored.
Was this page helpful?