API Documentation

API is available via REST interface. All data passed to and from 2Hive is serialized into JSON strings.

    Please note: the same URL is used while sending moderation requests and receiving moderation results.

Request format

http://2hive.org/api/?apikey=API_KEY&data=[...]

Request Params

Properties Type Description
apikey String API Key unique for your Project. Get the key here.
data (optional) JSON Array JSONized Array of Moderation Requests. See detailed description of Moderation Request below.

It is highly recommended to send data through a POST request. Use GET for debugging purposes only!

Format for "data" param

Properties Type Description
id String Unique request identifier.
type String Rule type. Please see a moderation rules guideline below. You should create appropriate rules first in order to start work with 2Hive System.
content Array This data will be shown to moderators as the content to moderate. Represented as a list of objects of certain types.
"content" : [
    {"img"  : "http://site.com/filename.jpg"},
    {"text" : "Garage sale around the corner"}
],
                
See list of data types below.
context
(optional)
Array Moderation Request Context.
Contains additional information about the content to moderate.
"context" : [
    {"img"  : "http://site.com/avatar.jpg"},
    {"text" : "Adam Smit, 28"}
],

Represented as a list of objects of certain types. See list of data types below.

Optional.
lang String ISO 639-1 language code. If content language is unknown use lang:""

"content" and "context" data types

Properties Type Description
img String Absolute URL to image.
text String Any kind of text content. UTF-8 encoded.
audio Object { "url" : "http://cdn.com/file.mp3", "mime" : "audio/mpeg" } - URL and MIME for audio file.
video Object { "url" : "http://cdn.com/file.mp4", "mime" : "video/mp4" } - URL and MIME for video file.

Result data format

In 2Hive API we use the same URL for sending moderation requests and receiving moderation results.
So, each time you make a request to 2Hive API you will get a Moderation Result even if you do not specify "data" POST param in the request.

Please note: Moderation Result is returned ONLY in case there is any undelivered results!

Properties Type Description
id String Unique request identifier.
type String Content type.
status String Moderators' Resolution. Possible values:

'allow' - in case the content is fine
'disallow' - in case the content didn't pass moderation check

stat (optional) Object Contains statistic of Moderators' Resolutions in following format:

{ "allow" : 8, "disallow": 1 }

Optional.
reason (optional) String Reason of content block. Empty in case status is "allow". Optional.

Examples

Request


http://2hive.org/api?apikey=API_KEY&data=[
    {
        "id": "1234567890",
        "type" : "new_event",
        "content" : [
            {"img"  : "http://site.com/filename.jpg"},
            {"text" : "Garage sale around the corner"},
            {"audio" : { "url" : "http://cdn.com/file.mp3", "mime" : "audio/mpeg" }},
            {"video" : { "url" : "http://cdn.com/file.mp4", "mime" : "video/mp4" }}

        ],
        "context" : [
            {"text" : "Gregory Staithorpe, 36"},
            {"text" : "34 events, 1 ban"},
            {"img"  : "http://site.com/avatar.jpg"}
        ],
        "lang" : "en"
    },
    {...}
]
    

Response


{
    status: {
        code: 200,
        msg: "ok"
    },
    response: [
        {
            'id'     : '1234567890',
            'type'   : 'profile',
            'status' : 'disallow',
            'stat' : 
            {
                'allow'    : 1,
                'disallow' : 7
            }
        },
        {...}
    ]
}