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 wordlist = await client.wordlist.update('id');
console.log(wordlist.id);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
)
wordlist = client.wordlist.update(
id="id",
)
print(wordlist.id)require "moderation_api"
moderation_api = ModerationAPI::Client.new(secret_key: "My Secret Key")
wordlist = moderation_api.wordlist.update("id")
puts(wordlist)<?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 {
$wordlist = $client->wordlist->update(
'id',
description: 'description',
key: 'key',
name: 'name',
strict: true,
words: ['string'],
);
var_dump($wordlist);
} catch (APIException $e) {
echo $e->getMessage();
}using System;
using ModerationApi;
using ModerationApi.Models.Wordlist;
ModerationApiClient client = new();
WordlistUpdateParams parameters = new() { ID = "id" };
var wordlist = await client.Wordlist.Update(parameters);
Console.WriteLine(wordlist);{
"id": "<string>",
"name": "<string>",
"words": [
"<string>"
],
"createdAt": "<string>",
"organizationId": "<string>",
"userId": "<string>",
"strict": true
}{
"code": "BAD_REQUEST",
"message": "Invalid input data",
"issues": []
}{
"code": "UNAUTHORIZED",
"message": "Authorization not provided",
"issues": []
}{
"code": "NOT_FOUND",
"message": "Not found",
"issues": []
}Update wordlist
Update a 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 wordlist = await client.wordlist.update('id');
console.log(wordlist.id);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
)
wordlist = client.wordlist.update(
id="id",
)
print(wordlist.id)require "moderation_api"
moderation_api = ModerationAPI::Client.new(secret_key: "My Secret Key")
wordlist = moderation_api.wordlist.update("id")
puts(wordlist)<?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 {
$wordlist = $client->wordlist->update(
'id',
description: 'description',
key: 'key',
name: 'name',
strict: true,
words: ['string'],
);
var_dump($wordlist);
} catch (APIException $e) {
echo $e->getMessage();
}using System;
using ModerationApi;
using ModerationApi.Models.Wordlist;
ModerationApiClient client = new();
WordlistUpdateParams parameters = new() { ID = "id" };
var wordlist = await client.Wordlist.Update(parameters);
Console.WriteLine(wordlist);{
"id": "<string>",
"name": "<string>",
"words": [
"<string>"
],
"createdAt": "<string>",
"organizationId": "<string>",
"userId": "<string>",
"strict": true
}{
"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 update
Body
application/json
New name for the wordlist
New key for the wordlist
New description for the wordlist
New words for the wordlist. Replace the existing words with these new ones. Duplicate words will be ignored.
Deprecated. Now using threshold in project settings.
Response
Wordlist updated successfully
ID of the wordlist
Name of the wordlist
Words in the wordlist
Creation date of the wordlist
ID of the organization
ID of the user
Strict mode
Was this page helpful?