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.actions.execute.execute({ actionKey: 'actionKey' });
console.log(response.success);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.actions.execute.execute(
action_key="actionKey",
)
print(response.success)require "moderation_api"
moderation_api = ModerationAPI::Client.new(secret_key: "My Secret Key")
response = moderation_api.actions.execute.execute(action_key: "actionKey")
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->actions->execute->execute(
actionKey: 'actionKey',
authorIDs: ['string'],
contentIDs: ['string'],
duration: 0,
queueID: 'queueId',
value: 'value',
);
var_dump($response);
} catch (APIException $e) {
echo $e->getMessage();
}using System;
using ModerationApi;
using ModerationApi.Models.Actions.Execute;
ModerationApiClient client = new();
ExecuteExecuteParams parameters = new() { ActionKey = "actionKey" };
var response = await client.Actions.Execute.Execute(parameters);
Console.WriteLine(response);{
"success": true
}{
"code": "BAD_REQUEST",
"message": "Invalid input data",
"issues": []
}{
"code": "UNAUTHORIZED",
"message": "Authorization not provided",
"issues": []
}{
"code": "NOT_FOUND",
"message": "Not found",
"issues": []
}Execute moderation action
Execute a moderation action on one or more content items.
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.actions.execute.execute({ actionKey: 'actionKey' });
console.log(response.success);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.actions.execute.execute(
action_key="actionKey",
)
print(response.success)require "moderation_api"
moderation_api = ModerationAPI::Client.new(secret_key: "My Secret Key")
response = moderation_api.actions.execute.execute(action_key: "actionKey")
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->actions->execute->execute(
actionKey: 'actionKey',
authorIDs: ['string'],
contentIDs: ['string'],
duration: 0,
queueID: 'queueId',
value: 'value',
);
var_dump($response);
} catch (APIException $e) {
echo $e->getMessage();
}using System;
using ModerationApi;
using ModerationApi.Models.Actions.Execute;
ModerationApiClient client = new();
ExecuteExecuteParams parameters = new() { ActionKey = "actionKey" };
var response = await client.Actions.Execute.Execute(parameters);
Console.WriteLine(response);{
"success": 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.
Body
application/json
Input parameters
ID or key of the action to execute
IDs of the content items to apply the action to. Provide this or authorIds.
IDs of the authors to apply the action to. Provide this or contentIds.
Optional value to provide with the action
Optional queue ID if the action is queue-specific
Optional duration in milliseconds for actions with timeouts
Required range:
x >= 0Response
Action executed successfully
Execution result
Whether the action was executed successfully
Was this page helpful?