API - Documentation
Getting Your Access Token
You can get your access token into APP > Settings > API Settings.
Analyze
{
"url": "http://api.smartmoderation.com/v2.0/analyze?access_token=" + access_token,
"method": "POST",
"json": true,
"body": {
"message": "Hello, what a shitty day",
"request_id": 1
}
}
$data = array(
"message" => "Try the smart moderation API",
"request_id" => 1
);
$options = array(
"http" => array(
"header" => "Content-type: application/json".
"method" => "POST",
"content" => json_encode($data),
),
);
The above command returns JSON structured like this:
{
"data": {
"categories": [
1
],
"rates": [
"1.00"
],
"content": "Try the smart moderation API",
"request_id": "1",
"lang": "ENG"
}
}
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.
HTTP Request & Response
POST - http://api.smartmoderation.com/v2.0/analyze?access_token=[your_access_token]
Query Parameters
Parameter | Type | Required | Description |
---|---|---|---|
message | string | true | Text Content for Moderation |
request_id | string | true | Returns given id for async cases |
Pages
Insert a New Page
{
"url": "http://api.smartmoderation.com/v2.0/page/insert?access_token=" + access_token,
"method": "POST",
"json": true,
"body": {
"page_id": "example_page-1",
"page_name": "Example API Page",
"page_img": "http://www.example.com/img/page_image.jpg"
}
}
$data = array(
"page_id" => "example_page-1",
"page_name" => "Example API Page",
"page_img" => "http://www.example.com/img/page_image.jpg",
);
$options = array(
"http" => array(
"header" => "Content-type: application/json".
"method" => "POST",
"content" => json_encode($data),
),
);
The above command returns JSON structured like this:
{
"data": {
"page_id": "example_page-1",
"page_name": "Example API Page",
"page_img": "http://www.example.com/img/page_image.jpg"
}
}
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
HTTP Request & Response
POST - http://api.smartmoderation.com/v2.0/page/insert?access_token=[your_access_token]
Parameter | Type | Required | Description |
---|---|---|---|
page_id | string | true | ID of your new page. |
page_name | string | true | Name of your new page |
page_img | a valid URL | false | Your new page's image URL |
Remove a Page
{
"url": "http://api.smartmoderation.com/v2.0/page/remove?access_token=" + access_token,
"method": "POST",
"json": true,
"body": {
"page_id": "example_page-1"
}
}
$data = array("page_id" => "example_page-1");
$options = array(
"http" => array(
"header" => "Content-type: application/json".
"method" => "POST",
"content" => json_encode($data),
),
);
The above command returns JSON structured like this:
{
"data": {
"success": true
}
}
You can remove your specific pages into the Smart Moderation via Rest API.You can add it back later if you want the removed pages.
HTTP Request & Response
POST - http://api.smartmoderation.com/v2.0/page/remove?access_token=[your_access_token]
Parameter | Type | Required | Description |
---|---|---|---|
page_id | string | false | The ID of the page to be deleted |
Get Page List
{
"url": "http://api.smartmoderation.com/v2.0/page/list/?access_token=" + access_token,
"method": "GET",
"json": true
}
$options = array(
"http" => array(
"header" => "Content-type: application/json".
"method" => "GET"
),
);
The above command returns JSON structured like this:
{
"data": [
{
"name": "Example API Page",
"page_id": "example_page-1",
"img": "http://www.example.com/img/page_image.jpg",
"site": "API",
"follower_count": 0,
"admins": [],
"black_list": [],
"settings": {
"spam_filter": true,
"desktop_notification": true,
"auto_hide": false
},
"users": [
{
"email": "example@example.com",
"page_access_token": "11111111111111111111111111111111",
"role": "PERSONAL",
"is_active": true,
"_id": 1111111111111111111111,
}
]
},
//List of your all pages.
]
}
Smart Moderation lists messages in the attached page.
HTTP Request & Response
GET - http://api.smartmoderation.com/v2.0/page/list/?access_token=[your_access_token]
Get a Page
{
"url": "http://api.smartmoderation.com/v2.0/page/[page_id]?access_token=" + access_token,
"method": "GET",
"json": true
}
$options = array(
"http" => array(
"header" => "Content-type: application/json".
"method" => "GET"
),
);
The above command returns JSON structured like this:
{
"data": {
"name": "Example API Page",
"page_id": "example_page-1",
"img": "http://www.example.com/img/page_image.jpg",
"site": "API",
"follower_count": 0,
"admins": [],
"black_list": [],
"settings": {
"spam_filter": true,
"desktop_notification": true,
"auto_hide": false
},
"users": [
{
"email": "example@example.com",
"page_access_token": "11111111111111111111111111111111",
"role": "PERSONAL",
"is_active": true,
"_id": 1111111111111111111111,
}
]
}
}
The page you want to add Smart Moderation brings to the system.
HTTP Request & Response
GET - http://api.smartmoderation.com/v2.0/page/[page_id]?access_token=[your_access_token]
Messages
Insert a New Message
{
"url": "http://api.smartmoderation.com/v2.0/message/insert?access_token=" + access_token,
"method": "POST",
"json": true,
"body": {
"message_id": "message-1",
"page_id": "example_page-1",
"image": "http://www.example.com/img/photo.jpg",
"from": {
"id": "message_owner_1",
"name": "Smart Moderation"
},
"message": "I'm trying the Smart Moderation API v2.0",
"request_id": "request_1"
}
}
$data = array(
"message_id" => "message-1",
"page_id" => "example_page-1",
"image" => "http://www.example.com/img/photo.jpg",
"from" => array(
"id" => "message_owner_1",
"name" => "Smart Moderation"),
"message" => "I'm trying the Smart Moderation API v2.0",
"request_id" => "request_1"
);
$options = array(
"http" => array(
"header" => "Content-type: application/json".
"method" => "POST",
"content" => json_encode($data),
),
);
The above command returns JSON structured like this:
{
"data": {
"categories": [
1
],
"rates": [
"1.00"
],
"content": "I'm trying the Smart Moderation API v2.0",
"requestID": "request_1",
"lang": "ENG"
},
"status": "ok"
}
Smart moderation added messages from the mail system found in the pages of attachments.
HTTP Request & Response
POST - http://api.smartmoderation.com/v2.0/message/insert?access_token=[your_access_token]
Parameter | Type | Required | Description |
---|---|---|---|
message_id | string | true | ID of the message |
page_id | string | true | ID of the page |
message | string | true | Your message |
image | must be a valid URL | false | Your new message's image URL |
from.id | string | true | ID of the content owner |
from.name | string | true | Name of the content owner |
page_link | must be a valid URL | false | Your page link |
request_id | string | true | Returns given id for async cases |
Get Messages
{
"url": "http://api.smartmoderation.com/v2.0/message/list/[page_id]?access_token=" + access_token + "&limit=150&next=0",
"method": "GET",
"json": true
}
$options = array(
"http" => array(
"header" => "Content-type: application/json".
"method" => "GET"
),
);
The above command returns JSON structured like this:
{
"data": [
{
"id": "message-1",
"page_id": "example_page-1",
"feed_id": "example_page-1",
"page_name": "Example API Page",
"message": "I'm trying the Smart Moderation API",
"sentiment": "OK",
"sentiment_rate": 100,
"lang": "ENG",
"created_time": 1475568844,
"is_deleted": true,
"from": {
"id": "message_owner_1",
"name": "Smart Moderation",
}
},
//... List of messages
]
}
You can get your added messages in Smart Moderation using your page_id.
HTTP Request & Response
GET - http://api.smartmoderation.com/v2.0/message/list/[page_id]?access_token=[your_access_token]
Sample Request
Parameter | Type | Required | Description |
---|---|---|---|
limit | integer | false | Response message limit.max:150 |
next | integer | false | Number of message will be skipped. |
Web Hook
You can moderate your messages from Smart Moderation Dashboard. If you want to do this, you should define your callback urls to Smart Moderation.
Add a Subscription
{
"url": "http://api.smartmoderation.com/v2.0/subscribe?access_token=" + access_token,
"method": "POST",
"json": true,
"body": {
"type": "reply",
"callback_url": "http://www.example.com/reply"
}
}
$data = array(
"type" => "reply",
"callback_url" => "http://www.example.com/reply"
);
$options = array(
"http" => array(
"header" => "Content-type: application/json".
"method" => "POST",
"content" => json_encode($data),
),
);
The above command returns JSON structured like this:
{
"data": {
"success": true
}
}
Smart Moderation callback_url to subscribe feature makes the system easily.
HTTP Request & Response
POST - http://api.smartmoderation.com/v2.0/subscribe?access_token=[your_access_token]
Parameter | Type | Required | Description |
---|---|---|---|
type | string | false | Your callback type. It must only contain one of reply, hide, status or delete |
callback_url | must be a valid URL | false | Your callback url. |
Delete a Subscription
{
"url": "http://api.smartmoderation.com/v2.0/subscribe?access_token=" + access_token,
"method": "DELETE",
"json": true,
"body": {
"type": "reply"
}
}
$data = array("type" => "reply");
$options = array(
"http" => array(
"header" => "Content-type: application/json".
"method" => "DELETE",
"content" => json_encode($data),
),
);
The above command returns JSON structured like this:
{
"data": {
"success": true
}
}
Smart Moderation subscribe to the callback_url feature easily removed from the system.
HTTP Request & Response
DELETE - http://api.smartmoderation.com/v2.0/subscribe?access_token=[your_access_token]
Parameter | Type | Required | Description |
---|---|---|---|
type | string | false | Your callback type. It must only contain one of reply, hide, status or delete |
Reply Message
{
"url": "http://api.smartmoderation.com/v2.0/message/reply?access_token=" + access_token,
"method": "POST",
"json": true,
"body": {
"page_id": "example_page-1",
"message_id": "message-1",
"message": "I am writing a reply to the message-1"
}
}
$data = array(
"page_id" => "example_page-1",
"message_id" => "message-1",
"message" => "I am writing a reply to the message-1"
);
$options = array(
"http" => array(
"header" => "Content-type: application/json".
"method" => "POST",
"content" => json_encode($data),
),
);
The above command returns JSON structured like this:
{
"data": {
"message_id": "message-1"
}
}
Using smart moderation callback URLs will respond to the message in the attached page.
HTTP Request & Response
POST - http://api.smartmoderation.com/v2.0/message/reply?access_token=[your_access_token]
NOTE
Parameter | Type | Required | Description |
---|---|---|---|
page_id | string | true | ID of the page |
message_id | string | true | ID of the message |
message | string | true | Your message for the reply |
Send Status of Message
{
"url": "http://api.smartmoderation.com/v2.0/message/status?access_token=" + access_token,
"method": "POST",
"json": true,
"body": {
"page_id": "example_page-1",
"message_id": "message-1"
}
}
$data = array(
"page_id" => "example_page-1",
"message_id" => "message-1"
);
$options = array(
"http" => array(
"header" => "Content-type: application/json".
"method" => "POST",
"content" => json_encode($data),
),
);
The above command returns JSON structured like this:
{
"data": {
"message_id": "message-1"
}
}
Adds the status of the message using Smart Moderation callback_urls.
HTTP Request & Response
POST - http://api.smartmoderation.com/v2.0/message/status?access_token=[your_access_token]
Note
Parameter | Type | Required | Description |
---|---|---|---|
page_id | integer | false | ID of the page |
message_id | integer | false | ID of the message |
Hide/Unhide a Message
{
"url": "http://api.smartmoderation.com/v2.0/message/hide?access_token=" + access_token,
"method": "POST",
"json": true,
"body": {
"page_id": "example_page-1",
"message_id": "message-1",
"status": "hide"
}
}
$data = array(
"page_id" => "example_page-1",
"message_id" => "message-1",
"status" => "hide"
);
$options = array(
"http" => array(
"header" => "Content-type: application/json".
"method" => "POST",
"content" => json_encode($data),
),
);
The above command returns JSON structured like this:
{
"data": {
"message_id": "message-1"
}
}
!!!!Adds the status of the message using Smart Moderation callback_urls.
HTTP Request & Response
POST - http://api.smartmoderation.com/v2.0/message/hide?access_token=[your_access_token]
Note
Parameter | Type | Required | Description |
---|---|---|---|
page_id | string | true | ID of the page |
message_id | string | true | ID of the message |
status | string | true | This field must contain "hide" or "unhide" |
Delete a Message
{
"url": "http://api.smartmoderation.com/v2.0/message/delete?access_token=" + access_token,
"method": "POST",
"json": true,
"body": {
"page_id": "example_page-1",
"message_id": "message-1"
}
}
$data = array(
"page_id" => "example_page-1",
"message_id" => "message-1"
);
$options = array(
"http" => array(
"header" => "Content-type: application/json".
"method" => "POST",
"content" => json_encode($data),
),
);
The above command returns JSON structured like this:
{
"data": {
"message_id": "message-1"
}
}
Smart moderation message is used to update the callback_url.
HTTP Request & Response
POST - http://api.smartmoderation.com/v2.0/message/update?access_token=[your_access_token]
Note
Parameter | Type | Required | Description |
---|---|---|---|
page_id | string | true | ID of the page |
message_id | string | true | ID of the message |
status | boolean | false | Your messages status |
Errors
Example Error
{ "data": null, "error": { "code": 2, "message": "Temporary issue due to downtime, retry the operation after waiting" } }
Example Error
{ "data": null, "error": { "code": 2, "message": "Temporary issue due to downtime, retry the operation after waiting" } }
The SmartModeration API uses the following error codes:
Error Code | Meaning |
---|---|
2 | Temporary issue due to downtime, retry the operation after waiting |
3 | There is no result for this content |
400 | SyntaxError : Unexpected token ... |
456 | Unexpected Character, please check your request parameters" |
457 | Method Not Allowed -- You tried to access a kitten with an invalid method |
406 | Invalid Access Token |
458 | Invalid Parameter |