Video Moderation / Interact with Video Moderation

Interact with Video Moderation Jobs

Introduction

Once you have launched video moderation jobs, such as live stream moderation jobs, you will receive callbacks from the Moderation Engine.

Callbacks are useful to keep you informed of the progress of your moderation jobs, and to keep you informed of any unwanted content.

On top of this, you can directly interact with moderation jobs, for instance to list on-going jobs or to stop a moderation job before it reaches it's normal end.

Get the list of on-going video moderations

At any time you can request a list of on-going video moderations, meaning video moderations that have been launched but have not reached the stopped or finished status.

This can be useful if you hit your maximum concurrency limit, to see what moderations are on-going, or if you wish to monitor the progress of videos but don't have access to the stream ids.


curl -X GET -G 'https://api.sightengine.com/1.0/video/ongoing.json' \
  -d 'api_user={api_user}' \
  -d 'api_secret={api_secret}'


# this example uses requests
import requests
import json

params = {'api_user': '{api_user}', 'api_secret': '{api_secret}'}
r = requests.get('https://api.sightengine.com/1.0/video/ongoing.json', params=params)

output = json.loads(r.text)


$params = array(
  'api_user' => '{api_user}',
  'api_secret' => '{api_secret}',
);

// this example uses cURL
$ch = curl_init('https://api.sightengine.com/1.0/video/ongoing.json?'.http_build_query($params));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
curl_close($ch);

$output = json_decode($response, true);


// this example uses axios
const axios = require('axios');

axios.get('https://api.sightengine.com/1.0/video/ongoing.json', {
  params: {
    'api_user': '{api_user}',
    'api_secret': '{api_secret}',
  }
})
.then(function (response) {
  // on success: handle response
  console.log(response.data);
})
.catch(function (error) {
  // handle error
  if (error.response) console.log(error.response.data);
  else console.log(error.message);
});

Get the status and results of an on-going video moderation

Please use callbacks to track moderation jobs. Callbacks are much more efficient for both you and Sightengine. Polling requests are rate-limited so polling would not scale and might introduce unwanted delays. Learn how


# {media_id} is the id of the media that is being moderated
# this id is given to you by the API when you perform a moderation request
curl -X GET -G 'https://api.sightengine.com/1.0/video/byid.json' \
  -d 'id={media_id}' \
  -d 'api_user={api_user}' \
  -d 'api_secret={api_secret}'


# this example uses requests
import requests
import json

params = {
  # {media_id} is the id of the media that is being moderated
  # this id is given to you by the API when you perform a moderation request
  'id': '{media_id}',
  'api_user': '{api_user}',
  'api_secret': '{api_secret}'
}
r = requests.get('https://api.sightengine.com/1.0/video/byid.json', params=params)

output = json.loads(r.text)


$params = array(
  // {media_id} is the id of the media that is being moderated
  // this id is given to you by the API when you perform a moderation request
  'id' => '{media_id}',
  'api_user' => '{api_user}',
  'api_secret' => '{api_secret}',
);

// this example uses cURL
$ch = curl_init('https://api.sightengine.com/1.0/video/byid.json?'.http_build_query($params));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
curl_close($ch);

$output = json_decode($response, true);


// this example uses axios
const axios = require('axios');

axios.get('https://api.sightengine.com/1.0/video/byid.json', {
  params: {
    'id': '{media_id}',
    'api_user': '{api_user}',
    'api_secret': '{api_secret}',
  }
})
.then(function (response) {
  // on success: handle response
  console.log(response);
})
.catch(function (error) {
  // handle error
  if (error.response) console.log(error.response.data);
  else console.log(error.message);
});

Stop a video moderation before it ends

In general you should not worry about having to stop Video Moderation. Moderation actions automatically finish once the video ends or once the video timeout has been reached. Early Stopping is useful either if you have a long running video and realize you don't want/need to run it through moderation until the end, or if you made a mistake and need to stop Moderation immediately.

To stop a video, simply perform the following command, providing the video's media id.


# {media_id} is the id of the media that is being moderated
# this id is given to you by the API when you perform a moderation request
curl -X DELETE 'https://api.sightengine.com/1.0/video/byid.json' \
  -d 'id={media_id}' \
  -d 'api_user={api_user}' \
  -d 'api_secret={api_secret}'


# this example uses requests
import requests
import json

data = {
  # {media_id} is the id of the media that is being moderated
  # this id is given to you by the API when you perform a moderation request
  'id': '{media_id}',
  'api_user': '{api_user}',
  'api_secret': '{api_secret}'
}
r = requests.delete('https://api.sightengine.com/1.0/video/byid.json', data=data)

output = json.loads(r.text)


$params = array(
  // {media_id} is the id of the media that is being moderated
  // this id is given to you by the API when you perform a moderation request
  'id' => '{media_id}',
  'api_user' => '{api_user}',
  'api_secret' => '{api_secret}',
);

// this example uses cURL
$ch = curl_init('https://api.sightengine.com/1.0/video/byid.json');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'DELETE');
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($params));
$response = curl_exec($ch);
curl_close($ch);

$output = json_decode($response, true);


// this example uses axios and querystring
const axios = require('axios');
const qs = require('querystring');

data = {
  'id': '{media_id}',
  'api_user': '{api_user}',
  'api_secret': '{api_secret}',
}

axios.delete('https://api.sightengine.com/1.0/video/byid.json', {params: data})
.then(function (response) {
  // on success: handle response
  console.log(response.data);
})
.catch(function (error) {
  // handle error
  if (error.response) console.log(error.response.data);
  else console.log(error.message);
});

Did you find this page helpful?

We're always looking for advice to help improve our documentation!

Let us know what you think

Cookies help us deliver our services. By using our services, you agree to our use of cookies. Learn more

OK