Quickstart Guide

Content moderation provides external RESTful API services. See the API List below.

1. Access Domain

Service access is realized through domain name resolution. Regional access domain names are as follows:

RegionDomain Name
Chinaai.jocloud.com

For other regions, contact customer support.

2. Request Structure

RESTful API HTTP requests use JSON format. The JSON structure varies depending on the service request. See details in API List; click on an API's name for its definition.
To ensure the clarity and security of API communication, request path format and communication method definitions are provided below:

Request Path

The request path differentiates moderation services. For details on all service access paths, see the API Listand click on a API for its definition.
Take the synchronous image content moderation API path as an example; its full request path is https://ai.jocloud.com/app/123456/v1/image/sync?traceId=bd526528-c0d7-4aa4-803b-f5a3fdc05805

wherein

  • ai.jocloud.com specifies this particular API's service access domain name;
  • 123456789 is the service ID;
  • v1 is the API version (the current version is v1);
  • /image/sync is the URL of the specific service—i.e. of the synchronous image content moderation API;
  • traceId=bd526528-c0d7-4aa4-803b-f5a3fdc05805 specifies a trace ID for the user to differentiate requests.

Communication Protocol

All APIs send requests by HTTPS protocol. Using HTTP requests will prompt a response to convert to HTTPS.

Character Encoding

Both the request and its return are encoded in UTF-8.

Request Parameters

Enter request parameters into the request body in JSON format. For service parameter details, see the API introduction page.

3 Identity Authentication

Before using the RESTful API, fill in the token field in the HTTP request's header for authentication. This document provides sample code for generating the token field with Java or Go. Refer to the code for the corresponding token values.

You will need to enter the certificate ID and certificate key into the code. To obtain these, log in and navigate to My Center. Click on your account name in the upper righthand corner, then select "API Certificate" from the drop-down menu.

Sample Code in Java

String restfulId = "qawsedrftg";        // Your Certificate ID
String restfulSecret = "abcdefghijk";   // Your Certificate Key

// Generate token
String plainIDSecret = restfulId + ":" + restfulSecret;
String base64IDSecret = new String(Base64.encodeBase64(plainIDSecret.getBytes("UTF-8")));

// Generate request object and add token information to request header
Request request = new Request.Builder()
    .addHeader("token", "Basic " + base64IDSecret)

Sample Code in Python

#!/usr/bin/python3
import requests
import base64

appid = 123456                 # Your Service id
restful_id = 'qawsedrftg'      # Your certificate ID
restful_secret = 'abcdefghijk' # Your certificate key

# Fill in http header
headers = {
    "content-type": "application/json"
}
# Generate Token
auth = base64.b64encode(("%s:%s" % (restful_id, restful_secret)).encode('utf-8'))
headers['token'] = 'Base ' + str(auth,'utf-8')

# request
url = "https://ai.jocloud.com/app/123456/v1/image/sync?traceId=bd526528-c0d7-4aa4-803b-f5a3fdc05805"
body = {}
res = requests.post(url, json=body, headers=headers)

4. API List

AI moderation currently supports images, text, audio files and video files, providing API URL-based HTTPS POST requests:

Moderation ObjectFunctionDescription
ImageImage ModerationDetect any illegal content in images
AudioVoice ModerationDetect any illegal content in voice clips
TextText ModerationDetect any illegal content in text passages
VideoVideo ModerationDetect any illegal audio or video content in video clips
StreamStream ModerationDetect any illegal content in real-time audio and/or video streams
Live StreamingLive Streaming ModerationDetect any illegal content within Jocloud's live streaming system

Image Moderation

APIDetection ModeDefault ConcurrencyDescription
app/{appid}/v1/image/syncSynchronous20Synchronous image moderation

Voice Moderation

APIDetection ModeDefault ConcurrencyDescription
app/{appid}/v1/audio/syncSynchronous20Synchronous voice moderation
app/{appid}/v1/audio/asyncAsynchronous20Asynchronous voice moderation

Text Moderation

APIDetection ModeDefault ConcurrencyDescription
app/{appid}/v1/text/syncSynchronous20Synchronous text moderation

Video Moderation

APIDetection ModeDefault ConcurrencyDescription
app/{appid}/v1/video/asyncAsynchronous20Asynchronous video moderation

Stream Moderation

APIDetection ModeDefault ConcurrencyDescription
app/{appid}/v1/video/liveReal-time20Real-time audio/video stream moderation

Live Streaming Moderation

APIDetection ModeDefault ConcurrencyDescription
app/{appId}/v1/ai/audio/liveReal-time20Jocloud Audio Interaction moderation
app/{appId}/v1/ai/video/live/Real-time20Jocloud Video Interaction moderation

5. Moderation Flowchart

Synchronous Detection

image


Asynchronous Detection

image


Real-Time Tasks Detection

image

<