REST API

Smart Moderation can integrate with any digital platform with API.

Getting Your Access Token

You can get your access token into dashboard > settings > API.

Analyze

Smart Moderation uses easy to use REST API system, Integrate with your project with any programming language, just copy and paste the corresponding code snippet. ;

Request & Response

HTTP - POST - https://www.smartmoderation.com/api/v1.0/analyze?access_token=

Sample Request JSON

{ "message": "Try the smart moderation API", "requestID": 1 }

Post Fields

message
Text Content for Moderation ( required )
requestID
Returns given id for async cases ( required )

Succesful Response

{ "data": { "categories": [0], //Moderation result 0 is 'Inappropriate and 1 is 'OK'. "rates": ["0.92"], "message": "Try the smart moderation API", "lang": "en", "requestID": "1" } }

Example Codes

var http = require("http"); var server = http.createServer(); var request = require("request"); var access_token = ""; var options = { "url":"https://www.smartmoderation.com/api/v1.0/analyze?access_token=" + access_token, "method":"POST", "json":true, "body": { "message": "Hello, what a shitty day", "requestID": 1 } } request(options,function(err,res,body){ if (err) { console.log(err); }else{ console.log(body); } }); server.listen("2874");
import requests import json data = { "message": "Hello, what a shitty day", "requestID": 1 } response = requests.post("https://www.smartmoderation.com/api/v1.0/analyze?access_token=, data=json.dumps(data), print json.loads(response.text)
require "uri" require 'json' uri = URI.parse("https://www.smartmoderation.com/api/v1.0/analyze?access_token=") http = Net::HTTP.new(uri.host, uri.port) http.use_ssl = true request = Net::HTTP::Post.new(uri.request_uri) # Set POST data request.body = { "message": "Hello, what a shitty day", "requestID": 1 }.to_json # Set headers request.add_field("Content-Type", "application/json") request.add_field("Authorization", "token 947ce574c082158a6cc5bd808c22bb9412a206db") puts(http.request(request).body)
$url = 'https://www.smartmoderation.com/api/v1.0/analyze?access_token='; $data = array('message' => array('some text to test')); $options = array( 'http' => array( 'header' => "Content-type: application/json\r\n". "Authorization:token 947ce574c082158a6cc5bd808c22bb9412a206db\r\n", 'method' => 'POST', 'content' => json_encode($data), ), ); $context = stream_context_create($options); $result = file_get_contents($url, false, $context); var_dump($result);
import java.net.HttpURLConnection; import java.net.URL; import java.net.URLEncoder; import java.io.DataOutputStream; import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.OutputStreamWriter; import java.io.InputStream; import java.lang.StringBuffer; public class HelloWorld { public static void main(String[] args) { String access_token=""; URL url; HttpURLConnection connection = null; try { //Create connection url = new URL("https://www.smartmoderation.com/api/v1.0/analyze?access_token="+access_token); connection = (HttpURLConnection)url.openConnection(); connection.setRequestMethod("POST"); connection.setRequestProperty("Content-Type", "application/json"); connection.setUseCaches (false); connection.setDoInput(true); connection.setDoOutput(true); //Send request OutputStreamWriter wr = new OutputStreamWriter(connection.getOutputStream()); wr.write ("{\"message\": \"some text to test\"}"); wr.write ("{\"requestID\": 1}"); wr.flush (); wr.close (); //Get Response InputStream is = connection.getInputStream(); BufferedReader rd = new BufferedReader(new InputStreamReader(is)); String line; StringBuffer response = new StringBuffer(); while((line = rd.readLine()) != null) { response.append(line); response.append('\r'); } rd.close(); System.out.println(response.toString()); } catch (Exception e) { e.printStackTrace(); } finally { if(connection != null) connection.disconnect(); } } }

Insert

You can insert your specific pages into the Smart Moderation via Rest API. After that you can track your contents on the Smart Moderation dashboard

Request & Response

HTTP - POST - https://www.smartmoderation.com/api/v1.0/insert?access_token=

Sample Request JSON

{ "id":"Your Message ID", "page_id":"Your Page ID", "page_name":"Your Page Name", "from":{ "id":"Message Owner ID", "name":"Message Owner" }, "page_link":"http://www.yoursite.com/yourpage", "message": "I'm trying the Smart Moderation API", "requestID": 1 }

Post Fields

id
ID of the message ( required )
page_id
ID of the page ( required )
page_name
Name of the page ( required )
message
Your message
photo
Image content
from.id
ID of the content owner
from.name
Name of the content owner
page_link
Your page link
requestID
Returns given id for async cases ( required )

Succesful Response

{ "status": "ok", "requestID": 1, "data": { "id": "Your Message ID", "page_id": "Your Page ID", "page_name": "Your Page Name", "message": "I'm trying the Smart Moderation API", "page_link": "http://www.yoursite.com/yourpage", "created_time": 1460399467, //seconds "from": { "id": "Message Owner ID", "name": "Message Owner Name" } } }

Get Messages

You can get your added messages in Smart Moderation using your pageID.

Request & Response

HTTP - GET - https://www.smartmoderation.com/api/v1.0/messages/?access_token=

Sample Request

https://www.smartmoderation.com/api/v1.0/messages/?access_token=&limit=150&next=0

Query Fields

limit
Response message limit. max:150 ( optional )
next
Number of message will be skipped. ( optional )

Succesful Response

{ "data": [ { "_id": "Message ID", "page_id": "Your page ID", "page_name": "Your page name", "message": "Try the Smart Moderation API", "media_link": "http://www.yoursite.com/page", "created_time": 1460383237, // seconds "from": { "id": "Message Owner ID", "name": "Message Owner Name" } } //... ] }

Error Codes

{ "data": null, "error": { "code": 2, "message": "Temporary issue due to downtime, retry the operation after waiting" } }

{ "data": null, "error": { "code": 3, "message": "There is no result for this content" } }

{ "data": null, "error": { "code": 400, "message": "SyntaxError : Unexpected token ..." } }

{ "data": null, "error": { "code": 456, "message": "Unexpected Character, please check your request parameters" } }

{ "data": null, "error": { "code": 457, "message": "Invalid Access Token" } }

{ "data": null, "error": { "code": 458, "message": "Invalid Parameter" } }

Smart Moderation

Smart Moderation use machine learning and natural language processing to detect offensive content, abusive language, spam, trolling and bot attacks and - optionally - automatically remove those content from the platform in real time.

Core Networks

Smart Moderation © 2017 PrivacyPolicyTerms Created with