SlideShare uma empresa Scribd logo
1 de 29
Baixar para ler offline
Implementation Guide




Version 6.0

October 2012           1
Index

Index ................................................................................................................ 2

1    About this document ..................................................................................... 4

2    About the moderation process ........................................................................ 4

3    Integration Mechanisms ................................................................................. 5

    3.1    Integration via REST ................................................................................ 5

     3.1.1      Asynchronic integration method ........................................................... 5

          3.1.1.1    Submitting / retrieving contents to moderate ................................... 5

           3.1.1.1.1      XML submitting format ............................................................. 6

           3.1.1.1.2      Reception confirmation ............................................................. 7

          3.1.1.2    Retrieving moderation results ........................................................ 8

           3.1.1.2.1      Moderation result XML format ................................................... 8

     3.1.2      Synchronic integration method .......................................................... 10

    3.2    Integration via API ................................................................................ 11

     3.2.1      PHP API .......................................................................................... 12

          3.2.1.1    API set-up ................................................................................. 12

          3.2.1.2    API initialization ......................................................................... 12

          3.2.1.3    Example of asynchronic moderation. ............................................. 12

          3.2.1.4    Example of asynchronic reception ................................................. 14

          3.2.1.5    Example of synchronic moderation ............................................... 15

          3.2.1.6    Configuration file ........................................................................ 16

     3.2.2      API Java ......................................................................................... 16

          3.2.2.1    API use and examples ................................................................. 16

          3.2.2.2    Configuration file ........................................................................ 16

    3.3    Integration via Plugins ........................................................................... 17

     3.3.1      Wordpress Plugin ............................................................................. 17

          3.3.1.1    Wordpress plugin setup ............................................................... 17

          3.3.1.2    Wordpress plugin configuration .................................................... 17

          3.3.1.3    Plugin test ................................................................................. 20
3.3.2     Facebook plugin ............................................................................... 20

    3.4   HTTPS protocol ..................................................................................... 20

4    Contents expiration ..................................................................................... 20

5    Remoderation and Moderation Mistakes ......................................................... 21

6    Following steps ........................................................................................... 21

7    Contact ...................................................................................................... 22

8    Appendix ................................................................................................... 23

    8.1   Input XML for Rest service descriptive table .............................................. 23

    8.2   Output XML descriptive table .................................................................. 25

    8.3   Synchronic moderation output XML descriptive table .................................. 26

    8.4   Descriptive table of the configuration file .................................................. 27
1   About this document

This document provides the necessary information to use the moderation
services provided by Keepcon.

It is orientated to those people with technical skills in charge of the development
and/or administration of a website.

This document is grouped in sections, covering the moderation process and
specific technical documentation on how to achieve a successful integration with
your site.




2   About the moderation process

Keepcon offers different types of moderation services, which are out of scope in
this present document, but beyond which particular service has been hired, all
of them include at least two operations: submitting contents to moderate
and receiving an answer for the moderated contents.

It is up to the clients to incorporate to their internal process the submittal of
information to moderate, the retrieval of its results and the consequent actions
on the basis of those results according to their own business rules.




Version 5.0

January 2011                                                                          4
3   Integration Mechanisms

3.1 Integration via REST


3.1.1 Asynchronic integration method

Asynchronic integration consists of performing operations of submitting content
to moderate and the inquiry of moderated contents in different moments,
without strict correlativity between them. In such a way, the client will have to
implement two independent processes, one for each mentioned operation.

Below, each operation is being described in detail, examples and steps to follow
are provided to achieve a successful integration.

3.1.1.1 Submitting / retrieving contents to moderate

Those contents to moderate should be submitted to Keepcon periodically and in
sets (with its size to be defined according to volume and concrete needs) by the
client.

For example, if the average volume of content to moderate is around 1000 per
hour, it would be necessary to submit sets of 50 elements every 3 minutes.

Keepcon provides a REST service to which the client will submit the content set
in XML format.

The service URL is the following:

http://service.keepcon.com/input/contentSet



How to use the service:

    1. Create the XML with the content in the format as detailed in section
       3.1.1.1.1.

    2. Invoke the service with a PUT HTTP by submitting the XML in the Request
       body. Basic-Authentication authentication method must be used with the
       user and password provided by Keepcon.

    3. Read the service answer within the Response body, and verify if the
       submittal was carried out satisfactorily. Otherwise, retry submitting it.
       See section 3.1.1.1.2.




Version 5.0

January 2011                                                                        5
3.1.1.1.1      XML submitting format
The submitted set of contents to moderate must follow the following XML
format:

<?xml version="1.0" encoding="UTF-8" ?>

<import>

       <contenttype>[account-name]</contenttype>

       <contents>

               <content id="1">

                       <author type="author">Jeff1989</author>

                       <url_context><![CDATA[http://blog.keepcon.com/?p=143]
                       ]></url_context>

                       <datetime>1262304000000</datetime>

                       <text><![CDATA[Hello my friends!!!]]></text>

                       <img><![CDATA[http://mysite.com/somepic.jpg]]></img
               >

                       <video><![CDATA[http://mysite.com/somevideo.flv]]></v
               ideo>

               </content>

               <content id="2">

                       <author type="author">Gandalf</author>

                       <url_context><![CDATA[http://blog.keepcon.com/?p=142]
                       ]></url_context>

                       <datetime>1262304000000</datetime>

                       <text><![CDATA[Hello everyone]]></text>

                      <img><![CDATA[http://mysite.com/una-
               foto.jpg]]></img>

                       <video><![CDATA[http://mysite.com/un-
               video.flv]]></video>

               </content>

       </contents>

</import>

Each XML element is detailed in section 8.1.


Version 5.0

January 2011                                                                   6
3.1.1.1.2      Reception confirmation
As a response to the submittal, Keepcon will send an answer confirming that the
contents set was successfully received, together with the set identifier generated
for that submittal. The response format will be the following.

Positive reception response format.

<?xml version="1.0" encoding="UTF-8" ?>
<response>
 <setId>35</setId>
 <status>OK</status>
</response>

Negative reception response format.

<?xml version="1.0" encoding="UTF-8" ?>
<response>
 <status>ERROR</status>
 <errorMessage>Some parsing error message</errorMessage>
</response>



Keepcon generates a setId value for every set of content received successfully.

. The client could use this number to do any type of tracking in its system.



Important:

It is very important to implement a retry mechanism. There is a possibility that
due to an unexpected error or planned maintenance , the content reception
service could fail. In those cases, the invoke process will have to detect the error
code or lack of response, and should have to proceed to retry with some
frequency until it is able to inject the contents into Keepcon platform.




Version 5.0

January 2011                                                                         7
3.1.1.2 Retrieving moderation results

Once the contents are processed, results will be available for the client.

The client will periodically check the REST service to obtain the results for the
moderated contents.



The URL is the following:

http://service.keepcon.com/output/contentSet?contextName=[account-
name]&clientACK=true

where [account-name] is the name of your company´s account.

How to use the service:

   1. Invoke the service with a PUT HTTP, submitting the account name
      opportunely provided by Keepcon as a parameter. Basic-Authentication
      method must be used with the user and password provided by Keepcon.

   2. Read the service answer included in the Response body. The answer
      format is detailed in the following section. In case the answer is empty, it
      means there are no moderation results available to be checked.

   3. Impact the moderation results according to your own business rules.

   4. Send ACK to Keepcon: This ACK is used by Keepcon to finalize the
      Moderation cycle of each content. If client don’t send the ACK in the next
      5 minutes, Keepcon will resend the same result set in the upcoming
      request. To send ACK you must call this REST service:
      http://service.keepcon.com:63081/output/contentSet/ack/[setId] where
      [setId] is the code of the result set which is inside the XML (see below)



3.1.1.2.1      Moderation result XML format
Moderation results that are submitted to the client will have the following XML
format:

<?xml version="1.0" encoding="UTF-8"?>

<export setId="3674">

       <contents>

               <content id="1" >

                     <moderatorName>moderator1</moderatorName>

                     <moderationDate>1272973151662</moderationDate>

                     <moderationDecision>REJECTED</moderationDecision>

                     <tagging>
Version 5.0

January 2011                                                                         8
<tag>Inapropiated</tag>

                     </tagging>

               </content>

               <content id="2" >

                     <moderatorName>moderator1</moderatorName>

                     <moderationDate>1272973151662</moderationDate>

                     <moderationDecision>APPROVED</moderationDecision>

                     <tagging/>

               </content>

       </contents>

</export>

Each XML element is detailed in section 7.2.




Version 5.0

January 2011                                                             9
3.1.2 Synchronic integration method

In this scenario, the client will submit to Keepcon contents to moderate one by
one, obtaining the moderation result synchronically for each submittal.

For this purpose, Keepcon provides a REST service to submit the information.

The URL is the following:

http://sync.keepcon.com/synchronic/moderate/

How to use the service:

   1. Create the XML with one content in the format detailed below.

   2. Invoke the service with a PUT HTTP by including the XML in the Request
      body. Basic-Authentication method must be used with the user and
      password provided by Keepcon.

   3. Read the service answer attached to the Response body, and verify if the
      operation was carried out successfully. See the XML response format
      detailed below.

   4. Impact the moderation results according to your own business rules.



Content to moderate should have the following XML format.

<?xml version="1.0" encoding="UTF-8" ?>

<import>

       <contenttype>[account-name]</contenttype>

       <contents>

               <content id="1">

                     <author type="author">Jhon1989</author>

                     <url_context><![CDATA[http://blog.keepcon.com/?p=143]
                     ]></url_context>

                     <datetime>1262304000000</datetime>

                     <text><![CDATA[Hello World!!!]]></text>

               </content>

       </contents>

</root>




Version 5.0

January 2011                                                                      10
Note: in case the service receives more than one content to moderate in the
same submittal, moderation will be cancelled and it will answer with ERROR
status.

As a response, the service will answer the moderation results in the following
XML format:

<?xml version="1.0" encoding="UTF-8"?>

<response>

       <status>OK</status>

       <content id="1" >

               <moderationDecision>REJECTED</moderationDecision>

               <tagging>

                     <tag>naked_bodies</tag>

                     <tag>contact_information</tag>

               </tagging>

       </content>

</response>

Each XML element is detailed in section 7.3.




Important:

It is very important to implement a retry mechanism. There is a possibility that
due to an unexpected error or planned maintenance, the content reception service
could fail. In those cases, the invoke process will have to detect the error code or
lack of response, and should have to proceed to retry with some frequency until it
is able to inject the contents into Keepcon platform.




3.2 Integration via API

It is possible to submit content to Keepcon´s server by using APIs available for
PHP and Java languages, instead of using REST services.

APIs are the integration method recommended by Keepcon because they are
easier to use and they tend to minimize errors.

Version 5.0

January 2011                                                                       11
Through APIs it is possible to use both synchronic and asynchronic moderation
mechanisms. Each API has an initialization file that is necessary to set up before
starting the process.

Before starting to use the API in the productive environment, it is important to
coordinate with Keepcon´s technical staff those fields that will be included in the
moderation process.


3.2.1 PHP API

3.2.1.1 API set-up

To set-up PHP API, files included in keepcon-api-php.zip must be copied in a file
accessible for the PHP code of your system. ZIP directory structure must be
respected.

If necessary, configuration variables of the file keepcon-client-api.ini could be
modified (see 3.2.1.6)

3.2.1.2 API initialization

The first step for the use of API is the initialization. This step has to be carried
out for both asynchronic and synchronic calls.

Initialization always has the following syntax:
<?php
require_once('../keepcon-client-api.php');

# The name of the Moderation Context and de Password should be
provided by Keepcon technical team.
$client = new KeepconClient('MyModerationContext', 'MyPassword',
'/path/to/keepcon-client-api.ini');
…

As it can be seen in the example, when creating the object KeepconClient, the
name of the moderation context and its correspondent password has to be
passed through parameters. Both the content type and the password must be
requested to Keepcon´s technical staff (support@keepcon.com).

It is possible for a company to use more than one moderation context. In that
case, several KeepconClient must be initialized, one for each moderation
context.

3.2.1.3 Example of asynchronic moderation.

In this example, it is shown how to use the API to submit a set of content to be
moderated in an asynchronic way.

After initializing the API, all the contents that the client wants to submit should
be put on a list. Each Moderation Context has its own field’s definition according
to the needs of each company.. It is possible for a content to have fields of
different types such as text, date, images and url. The structure defining field’s
Version 5.0

January 2011                                                                           12
quantity and types must be coordinated with Keepcon´s analysts. This structure
will be aligned with moderation rules of each company.

Once the content set is submitted, the object Response allows obtaining a token
generated by Keepcon´s server, which we call “ticket number”. This ticket can
be useful for error tracking in some circumstances.

Finally, the submittal status can be checked to determine if it was successful or
if there was some kind of error. In case of error, it is possible to obtain its
message. These errors generally occur due to an error in the content field’s
structure and if they appear, Keepcon´s technical staff should be contacted.

In case an exception is thrown during the submittal, the recommended logic is
to try it again latter. This only occurs when there is a connectivity problem or in
case Keepcon´s service is undergoing maintenance.
<?php
require_once('../keepcon-client-api.php');

$client = new KeepconClient('ThisIsMyContextName',
'ThisIsMyPassword', '/path/to/keepcon-client-api.ini');

$contents = array();

# Add a content
$content = new Content("1");
$content->add("comment", "This is the comment #1");
$content->add("author", "john");
$content->add("datetime", new DateTime());
array_push($contents, $content);

# Add another content
$content = new Content("2");
$content->add("comment", "This is the comment #2");
$content->add("author", "jules");
$content->add("datetime", new DateTime());
array_push($contents, $content);

try {
    # Send the contents to keepcon
    $response = $client->send($contents);

    # Obtain the ticket number for tracking porpoise
    $ticket_id = $response->getTicketId();

     # Check the response status to see if occur an error:
     if ($response->getStatus() == 'ERROR') {
         # TODO: Log the error and try again latter. This could be a
format error.
         $error_message = $response->getErrorMessage();
     }
} catch (KeepconClientException $e) {
     # There was a connectivity error.
}
Version 5.0

January 2011                                                                          13
?>


3.2.1.4 Example of asynchronic reception

This example shows how to retrieve moderation results. When retrieving these
results, the API will bring sets of 50 results at the most. If there are fewer
results available, then the API will bring a smaller set. In case there are no
results left, the API will bring zero results.

Once the API is initialized, the “results” method should be invoked and you
should iterate for the “moderationResults” collection to obtain the result of each
performed moderation.

From each ModerationResult the element ID and the moderation result can be
obtained to take action in your company system. Besides, additional information
can be obtained as well, like the moderator´s name, moderation data and
element´s Tags. Element’s Tags are used to relate the moderation policies of
your company, for example: “bad words”, “nudity”, “contact information”, etc.

Finally, you must send and ACK to Keepcon. This ACK is used by Keepcon to
finalize the Moderation cycle of each content. If client don’t send the ACK in the
next 5 minutes, Keepcon will resend the same result set in the upcoming
request.


<?php
require_once('../keepcon-client-api.php');

$client = new KeepconClient('ThisIsMyContextName',
'ThisIsMyPassword', '../keepcon-client-api.ini');

try {
    $response = $client->results();

     foreach ($response->getModerationResults() as $result) {
        # I can check moderation value for each element.
         $content_id = $result->getId();
         $moderator_name = $result->getModeratorName();
         $moderation_date = $result->getModerationDate();
         $tags = $result->getTags();

        #Check whether the element was approved, rejected or
unknown.
        $moderation_decision = $result->getModerationDecision();
        if ($moderation_decision == 'APPROVED') {
            # TODO: Approved element
        } elseif ($moderation_decision == 'REJECTED') {
            # TODO: Rejected element
        } elseif ($moderation_decision == 'UNKNOWN') {
            # TODO: Keepcon system was unable to take a moderation
decision for this element
        }
Version 5.0

January 2011                                                                         14
}
       #Send ACK to Keepcon.
     if (count($response->getModerationResults())) {
         $client->ack_results($response->getTicketId());
     }

} catch (KeepconClientException $e) {
    # There was a connection problem
}

?>

3.2.1.5 Example of synchronic moderation

This example shows how to invoke the synchronic moderation service.

After initializing the API, one content with its correspondent fields has to be
created and submit it invoking the “send_sync” method. This method submits
the content and brings the moderation result back.

The moderation result is inside a ModerationResult object, from which the ID
element and the moderation decision can be obtained to take action in the your
sytem. Besides, additional information can be obtained as well, like the
moderator´s name, moderation data and element´s TAGs.
<?php
require_once('../keepcon-client-api.php');

$client = new KeepconClient('ThisIsMyContextName',
'ThisIsMyPassword', '/path/to/keepcon-client-api.ini');

# Creo un content
$content = new Content("1");
$content->add("comment", "This is comment #1");
$content->add("author", "john");
$content->add("datetime", new DateTime());

try {
    # Send the content
    $response = $client->send_sync($content);

     # If there was an error, you can check the message:
     if ($response->getStatus() == 'ERROR') {

         $error_message = $response->getErrorMessage();
     } else {
         # Ticket id for tracking purpose
         $ticket_id = $response->getTicketId();

         # Check the moderation result
         $result = $response->getModerationResult();
         $content_id = $result->getId();
         $moderator_name = $result->getModeratorName();
         $moderation_date = $result->getModerationDate();
Version 5.0

January 2011                                                                      15
$tags = $result->getTags();
         $moderation_decision = $result->getModerationDecision();

        if ($moderation_decision == 'APPROVED') {
            # TODO: Approved content
        } elseif ($moderation_decision == 'REJECTED') {
            # TODO: Rejected content
        } elseif ($moderation_decision == 'UNKNOWN') {
            # TODO: Keepcon system was unable to take a moderation
decision for this element
        }
    }

} catch (KeepconClientException $e) {
    # There was a connection problem
}
?>



3.2.1.6 Configuration file

keepcon-client-api.ini configuration file is configured with default values that in
most cases are not necessary to modify.

In chapter 5.4 all the variables that compose this file are detailed.




3.2.2 API Java

The first step to start using API Java is to ask Keepcon´s technical staff for the
JAR file that has the API java classes, use examples and documentation in
Javadoc format.

3.2.2.1 API use and examples

examples-api-java.zip file has available examples to perform synchronic and
asynchronic moderations.

These examples were developed taking into account real implementations from
many of our clients. Therefore, this code can be used as template to start
integration from scratch. It is only necessary to implement those actions in each
moderation result: what to do in case of approving or rejecting an element in
your system.

3.2.2.2 Configuration file

keepcon-client-api.ini configuration file is configured with default values that in
most cases are not necessary to modify.

In chapter 5.4 all the variables that compose this configuration file are detailed.


Version 5.0

January 2011                                                                          16
3.3 Integration via Plugins


3.3.1 Wordpress Plugin

For those clients using Wordpress, the easiest way of integrating with
Keepcon´s platform is through the installation and configuration of a plugin
developed for that purpose.

3.3.1.1 Wordpress plugin setup

To setup the plugin unzip keepcon-wordpress-plugin.zip into the folder “wp-
content/plugins” of your Wordpress installation. Once unzipped, the plugin folder
will have another folder inside called “keepcon”.

After that, enter Wordpress plugins administration console, and a plugin called
“Keepcon Moderation Plugin” should appear listed. To activate it, press the
“Activate” link.




3.3.1.2 Wordpress plugin configuration

After activating the plugin, it has to be configured. For that, enter the
configuration screen by clicking “Keepcon Configuration” link that appears in
“Settings” section.




Version 5.0

January 2011                                                                        17
When you click on Keepcon Configuration, the following plugin configuration
screen will appear.




Version 5.0

January 2011                                                                  18
In this configuration screen, the only values which are necessary to modify are
“Content Type” and “Password”. To request these values, send an e-mail to
Keepcon´s technical staff (support@keepcon.com).

You can also configure the plugin to operate in synchronic or asynchronic
moderation modes.


Version 5.0

January 2011                                                                      19
. When using synchronic moderation, every user generated post will be
immediately processed by Keepcon, while the asynchronic way will be executed
every certain period of time.

The HTTPS protocol can also be used for the information to travel through a safe
channel.

Finally, the use of a Proxy can be configured if needed.

The remaining options must stay with the default values unless Keepcon´s
technical staff requests some particular change.

3.3.1.3 Plugin test

Before testing, get in touch with Keepcon´s technical staff to register the
account with its correspondent moderation rules.

Once the plugin is configured, the following steps can be tested:

    1. Create an inappropriate message in the correspondent blog.

    2. Verify that the message appears as published and that it also appears in
       Wordpress “Comments” screen.

    3. After around 30 seconds, the comment should be eliminated from the
       blog and should appear in the “Trash” folder in “Comments” screen. That
       means the comment was automatically moderated and eliminated by
       Keepcon.


3.3.2 Facebook plugin

Keepcon´s platform can import, moderate and eliminate comments and posts
generated in Facebook Wall pages.

To perform this integration, the only necessary thing is that the client grants
Keepcon certain permissions inside Facebook account. The rest of the import
process and messages deletion is performed automatically. It is not necessary to
codify anything additional.

To grant the requested permissions, ask Keepcon´s technical staff for the
document “Keepcon – Instructions for Facebook permission grant”.

3.4 HTTPS protocol

In order to achieve a better security for the contents transfer, Keepcon services
can be used through HTTPS Protocol. All of the available integration methods
(REST, PHP, Java, Wordpress and Facebook) can use this protocol.

Keepcon´s technical staff should be contacted to receive instructions on how to
use HTTPS.


4   Contents expiration
Version 5.0

January 2011                                                                        20
For those clients using our Manual Moderation Platform it is important to
mention that all contents that Keepcon´s platform receives have a default
expiration of 15 days. That is to say, if content is submitted and, during 15
days, this content is not manually moderated, it will be marked as expired and
will be discarded from our system. The only way of moderating it will be by
resending it.



In case a longer expiration is needed, it has to be requested to Keepcon´s
technical staff.


5   Remoderation and Moderation Mistakes

In some situations it is possible a single content to be moderated twice so your
system may receive two different results for the same content in different
moments. For example, you may receive a REJECTED result for content_id
=”133” and the next day you receive an APPROVED result for the same
content_id. This situation is used to happen when a manual or automatic
moderation mistake occurs and a revision action is done.

So our recommendation is that your system should be prepared to handle this
situation and it would be able to impact a new result for the same content_id.
But this is only a suggestion and it is up to your business rules.


6   Following steps

Once the integration between the client´s system and Keepcon´s platform is
finished, we recommend following these steps:

    •   Verify the correct import of contents: Ask for a user and a password to
        enter the platform (http://platform.keepcon.com) and visually verify that
        the contents appear as “pending for moderation”. It is important to
        submit contents that are not automatically moderated during this first
        step.

    •   Verify the correct export of results: Once the contents are visible in the
        platform, they have to be manually moderated by choosing different
        moderation criteria, for example, rejecting and approving contents by
        choosing different tags. After that, execute the code that gets the results
        and verify that the received values are the correct ones.

    •   Try the platform´s “Contents Administrator” to know how to search for
        historical elements.

    •   Try our Reports & BI Tool in http://tools.keepcon.com/sites/reports. This
        tool helps to visualize statistical graphics with useful information for
        people responsible of your site. This information is updated
        approximately every 3 hours.


Version 5.0

January 2011                                                                          21
7   Contact

If you have any request or inquiry, you can contact Keepcon´s staff, that will
guide you during the integration process:

    •   E-mail: support@keepcon.com




Version 5.0

January 2011                                                                     22
8        Appendix

8.1 Input XML for Rest service descriptive table

Each of the elements of this XML is described in the following table. Schema is
also available for performing validation before submitting content to Keepcon. If
needed, ask for the schema (XSD file) to Keepcon´s technical staff.

Some elements of the XML can be customized to satisfy client’s needs.



    Element /            Type of piece of         Description                             Required
    attribute            information

    setId                Attribute. String        Import lot identifier, generated by     No.
                                                  the client.

    contenttype          Element. String          This element has the context            Yes.
                                                  name assigned to the client.

                                                  This value is immutable and will
                                                  be provided by Keepcon.

    contents             Element.                 This element has multiple content       Yes.
                                                  type child elements, with the
                                                  contents to be moderated.

    content              Element.                 Content to moderate.                    Yes.

    id                   Attribute. Entire long   Only content identifier provided by     Yes.
                         positive.                the client.

    author               Element. Chain.          Name of the content´s author.           No, but
                                                  This piece of information is not        suggested.
                                                  obligatory if the client is not
                                                  interested in performing a follow-
                                                  up per user. It is suggested to
                                                  provide it anyway since the
                                                  moderation process is more
                                                  efficient taking this type of
                                                  information into account.




Version 5.0

January 2011                                                                         23
Element /     Type of piece of      Description                              Required
 attribute     information

 url_context   Element. String.      URL where the content is. The            No, but
                                     purpose of this is to visualize the      suggested.
                                     content in its context to
                                     disambiguate it in case of doubt.

 datetime      Element. Format UTC   Content creation date and time in        No, but
               in milliseconds.      order to use the chronological           suggested.
                                     order in the moderation queue
                                     prioritization whether it is a pre-
                                     moderation or a post-moderation
                                     model.

 type          Attribute. String.    Internal for the platform. Type of       Yes.
                                     field information.

 text          Element. String.      Content to moderate.                     Yes.

                                     Note: always write the content
                                     between <![CDATA[]]>, to avoid
                                     strange characters preventing
                                     from the correct use of the
                                     content.

 img           Element. String.      URL aiming to the image to               No.
                                     moderate.

                                     Formats: GIF, JPG, PNG and BMP.

 video         Element. String.      URL aiming to the video to               No.
                                     moderate.

                                     Note: Keepcon can practically
                                     manage any type of standard
                                     video format, but to convert it to
                                     FLV, it internally processes it, so if
                                     it is originally submitted as FLV,
                                     the moderation process efficiency
                                     notably improves, positively
                                     impacting on the response times.




Version 5.0

January 2011                                                             24
8.2 Output XML descriptive table

Each of the elements of this XML is described in the following table.

 Element /               Type of piece of          Description
 attribute               information

 setId                   Attribute. Entire long    In order to carry out a proper
                         positive.                 follow-up of the moderation
                                                   results submittal, Keepcon will
                                                   generate a unique identifier for
                                                   each group of submitted results.




 contents                Element.                  This element has multiple content
                                                   type child elements.

 content                 Element.                  A specific content.

 id                      Attribute. Entire long    Unique identifier of the UGC.
                         positive.

 moderationDecision      Attribute. String.        Shows the content moderation
                                                   decision. Possible values are:

                                                       •   REJECTED

                                                       •   APPROVED

                                                       •   UNKNOWN

 tagging                 Element.                  List of rejection reasons resulting
                                                   from the content moderation
                                                   process. In case the content has
                                                   an approved status, the list of
                                                   rejection reasons will be empty.




Version 5.0

January 2011                                                                          25
Element /               Type of piece of          Description
 attribute               information

 tag                     Element. String.          Content categorization resulting
                                                   from the moderation process.
                                                   Values will be defined for each
                                                   client according to their
                                                   moderation rules.




8.3 Synchronic moderation output XML descriptive table

Each of the elements of this XML is described in the following table.

 Element /               Type of piece of          Description
 attribute               information

 status                  Element. String.          It indicates if the request was
                                                   processed or not. Possible values
                                                   are:

                                                       •   OK

                                                       •   ERROR


 content                 Element.                  A particular content.

 id                      Attribute. Entire long    Unique identifier of the client
                         positive.                 generated content.

 moderationDecision      Element. String.          Shows the content moderation
                                                   decision. Possible values are:

                                                       •   REJECTED

                                                       •   APPROVED

                                                       •   UNKNOWN

 tagging                 Element.                  List of reject reasons as a
                                                   consequence of the content
                                                   moderation process. In case the
                                                   content has an approved status,
                                                   the list of reject reasons will be
                                                   empty.



Version 5.0

January 2011                                                                            26
Element /                  Type of piece of            Description
  attribute                  information

  tag                        Element. String.            Content categorization as a
                                                         consequence of the moderation
                                                         process. Values will be defined
                                                         according to each client´s
                                                         moderation rules.




8.4 Descriptive table of the configuration file

The API configuration file has the following variables. Most of the variables do
not need to modify the default values. But it is important to understand the
functioning of each of them.

Section               Name                     Default                          Description
keepcon_settings      keepcon_async_url        http://service.keepcon.com/inp   URL of the Keepcon service to
                                               ut/contentSet                    submit contents to moderate in an
                                                                                asynchronic way using protocol
                                                                                HTTP. This value should not be
                                                                                modified unless requested by
                                                                                Keepcon technicians.

                                                                                To use HTTPS the url with https://
                                                                                must be used.

keepcon_settings      keepcon_async_results_   http://service.keepcon.com/out   URL of the Keepcon service to
                      url                      put/contentSet?contextName=      obtain the results from asynchronic
                                                                                moderations by using protocol
                                                                                HTTP. This value should not be
                                                                                modified unless requested by
                                                                                Keepcon technicians.

                                                                                To use HTTPS the url with https://
                                                                                must be used.

keepcon_settings      keepcon_async_ack_url    http://service.keepcon.com:630   URL of the keepcon service to
                                               81/output/contentSet/ack/        submit ACK. Do not change this
                                                                                value.

keepcon_settings      keepcon_sync_url         http://sync.keepcon.com/synch    URL of the Keepcon service to
                                               ronic/moderate/                  moderate contents in a synchronic
                                                                                way. This value should not be
                                                                                modified unless requested by
                                                                                Keepcon technicians.

keepcon_settings      author_element_name      author                           For Keepcon´s internal use.

connection_settings   client_timeout           60                               Timeout in seconds to carry out the
                                                                                information transfers. Possibly, it
                                                                                will be necessary to adjust this
                                                                                value depending on the lengths of
                                                                                the texts to moderate and the
                                                                                conditions of the client´s network.

Version 5.0

January 2011                                                                                     27
connection_settings   send_retries        3                             Number of retries when facing a
                                                                        connection problem or packages
                                                                        lost. This value should not be
                                                                        modified unless requested by
                                                                        Keepcon technicians.

connection_settings   http_adapter        'HTTP_Request2_Adapter_Sock   Implementation of the adapter
                                          et'                           used by the client to connect to
                                                                        Keepcon´s server. Values it may
                                                                        take are:
                                                                        'HTTP_Request2_Adapter_Socket' o
                                                                        'HTTP_Request2_Adapter_Curl'.

                                                                        Just for PHP.

connection_settings   proxy_host                                        If it is necessary to use a proxy,
                                                                        these values should be filled.

connection_settings   proxy_port                                        If it is necessary to use a proxy,
                                                                        these values should be filled.

connection_settings   proxy_user                                        If it is necessary to use a proxy,
                                                                        these values should be filled.

connection_settings   proxy_password                                    If it is necessary to use a proxy,
                                                                        these values should be filled.

connection_settings   proxy_auth_scheme                                 If it is necessary to use a proxy,
                                                                        these values should be filled:
                                                                        "basic" o "digest".

logging               log_file            /tmp/keepcon.log              Directory where the API will
                                                                        generate the log file. The file will
                                                                        only be generated if the log is
                                                                        activated.

                                                                        Just for PHP.

logging               debug               False                         Indicates the API to generate
                                                                        Debug information in a log file. It is
                                                                        useful just in special circumstances
                                                                        where errors want to be detected.

logging               trace               False                         Indicates the API to generate
                                                                        Debug information in a more
                                                                        detailed way. It is useful just in
                                                                        special circumstances where errors
                                                                        want to be detected.

development           development         False                         If it is switched to True, requests
                                                                        are not send to Keepcon´s server
                                                                        but a false response is generated.

internal_options      ssl_verify_peer     False                         It indicates if Keepcon´s SSL
                                                                        certificate is verified. Only modify
                                                                        this value if requested by
                                                                        Keepcon´s support staff.

                                                                        Just for PHP.

internal_options      ssl_verify_host     False                         It indicates if the identity of
                                                                        Keepcon´s SSL certifícate host is
                                                                        verified. Only modify this value if
                                                                        requested by Keepcon´s support

Version 5.0

January 2011                                                                               28
staff.

                                              Just for PHP.

internal_options   follow_redirects   False   It indicates the http connector if it
                                              should follow the redirects sent by
                                              the server. If http_adapter is used
                                              = 'HTTP_Request2_Adapter_Curl'
                                              set this variable in True.




Version 5.0

January 2011                                                    29

Mais conteúdo relacionado

Mais procurados

Mais procurados (10)

BOOK - IBM tivoli netcool service quality manager data mediation gateway deve...
BOOK - IBM tivoli netcool service quality manager data mediation gateway deve...BOOK - IBM tivoli netcool service quality manager data mediation gateway deve...
BOOK - IBM tivoli netcool service quality manager data mediation gateway deve...
 
Open acc.1.0
Open acc.1.0Open acc.1.0
Open acc.1.0
 
High availability solutions
High availability solutionsHigh availability solutions
High availability solutions
 
MONGODB
MONGODBMONGODB
MONGODB
 
Managing an soa environment with tivoli redp4318
Managing an soa environment with tivoli redp4318Managing an soa environment with tivoli redp4318
Managing an soa environment with tivoli redp4318
 
Elisa
ElisaElisa
Elisa
 
installation_manual
installation_manualinstallation_manual
installation_manual
 
Content server-6.5-sp1-release-notes
Content server-6.5-sp1-release-notesContent server-6.5-sp1-release-notes
Content server-6.5-sp1-release-notes
 
Epics Qt requirements specification
Epics Qt requirements specificationEpics Qt requirements specification
Epics Qt requirements specification
 
Jdbc
JdbcJdbc
Jdbc
 

Destaque

Keepcon integration tutorial (December 2013)
Keepcon integration tutorial (December 2013)Keepcon integration tutorial (December 2013)
Keepcon integration tutorial (December 2013)keepcon-slides
 
Self Powerpoint
Self PowerpointSelf Powerpoint
Self Powerpointvermelog
 
Keepcon integration tutorial 2013
Keepcon   integration tutorial 2013Keepcon   integration tutorial 2013
Keepcon integration tutorial 2013keepcon-slides
 
Tratraball
TratraballTratraball
TratraballEnrska
 
Keepcon integrations- en-
Keepcon integrations- en-Keepcon integrations- en-
Keepcon integrations- en-keepcon-slides
 

Destaque (7)

Keepcon integration tutorial (December 2013)
Keepcon integration tutorial (December 2013)Keepcon integration tutorial (December 2013)
Keepcon integration tutorial (December 2013)
 
Self Powerpoint
Self PowerpointSelf Powerpoint
Self Powerpoint
 
Keepcon integration tutorial 2013
Keepcon   integration tutorial 2013Keepcon   integration tutorial 2013
Keepcon integration tutorial 2013
 
Ideation
IdeationIdeation
Ideation
 
Tratraball
TratraballTratraball
Tratraball
 
Keepcon integrations- en-
Keepcon integrations- en-Keepcon integrations- en-
Keepcon integrations- en-
 
The digital closet 2014 - slideshare - aug 20
The digital closet   2014 - slideshare - aug 20The digital closet   2014 - slideshare - aug 20
The digital closet 2014 - slideshare - aug 20
 

Semelhante a Implementation Guide for Keepcon Content Moderation Services

IME London - Send Transaction - WebServices - Specification.pdf
IME London - Send Transaction - WebServices - Specification.pdfIME London - Send Transaction - WebServices - Specification.pdf
IME London - Send Transaction - WebServices - Specification.pdfBaasanjargalBaynmunk
 
java web_programming
java web_programmingjava web_programming
java web_programmingbachector
 
Magento extension-developers-guide-v1.0
Magento extension-developers-guide-v1.0Magento extension-developers-guide-v1.0
Magento extension-developers-guide-v1.0lethevinh
 
GNU Gatekeeper 5.11
GNU Gatekeeper 5.11GNU Gatekeeper 5.11
GNU Gatekeeper 5.11J W
 
Magento 2 Spam and Bot Blocker
Magento 2 Spam and Bot BlockerMagento 2 Spam and Bot Blocker
Magento 2 Spam and Bot BlockerMageAnts
 
Product description vital qip next generation v7 2_en_feb09(1)
Product description vital qip next generation v7 2_en_feb09(1)Product description vital qip next generation v7 2_en_feb09(1)
Product description vital qip next generation v7 2_en_feb09(1)Roy Muy Golfo
 
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+GuideS Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guideguestd2fe1e
 
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+GuideS Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guideguestd2fe1e
 
Magento designguide
Magento designguideMagento designguide
Magento designguideideabenders
 
appserver.io tutorial
appserver.io tutorialappserver.io tutorial
appserver.io tutorialappserver.io
 
Magento 2 Infinite Scroll
Magento 2 Infinite ScrollMagento 2 Infinite Scroll
Magento 2 Infinite ScrollMageAnts
 
Siemens win cc manual win cc getting started
Siemens win cc manual win cc getting startedSiemens win cc manual win cc getting started
Siemens win cc manual win cc getting startedDien Ha The
 
An introduction to weblogic console
An introduction to weblogic consoleAn introduction to weblogic console
An introduction to weblogic consolebispsolutions
 
Certification study guide ibm tivoli access manager for e business 6.0 sg247202
Certification study guide ibm tivoli access manager for e business 6.0 sg247202Certification study guide ibm tivoli access manager for e business 6.0 sg247202
Certification study guide ibm tivoli access manager for e business 6.0 sg247202Banking at Ho Chi Minh city
 

Semelhante a Implementation Guide for Keepcon Content Moderation Services (20)

IME London - Send Transaction - WebServices - Specification.pdf
IME London - Send Transaction - WebServices - Specification.pdfIME London - Send Transaction - WebServices - Specification.pdf
IME London - Send Transaction - WebServices - Specification.pdf
 
java web_programming
java web_programmingjava web_programming
java web_programming
 
Webapp2 2.2
Webapp2 2.2Webapp2 2.2
Webapp2 2.2
 
Knowledge base
Knowledge baseKnowledge base
Knowledge base
 
Httpcore tutorial
Httpcore tutorialHttpcore tutorial
Httpcore tutorial
 
Magento extension-developers-guide-v1.0
Magento extension-developers-guide-v1.0Magento extension-developers-guide-v1.0
Magento extension-developers-guide-v1.0
 
GNU Gatekeeper 5.11
GNU Gatekeeper 5.11GNU Gatekeeper 5.11
GNU Gatekeeper 5.11
 
Magento 2 Spam and Bot Blocker
Magento 2 Spam and Bot BlockerMagento 2 Spam and Bot Blocker
Magento 2 Spam and Bot Blocker
 
Product description vital qip next generation v7 2_en_feb09(1)
Product description vital qip next generation v7 2_en_feb09(1)Product description vital qip next generation v7 2_en_feb09(1)
Product description vital qip next generation v7 2_en_feb09(1)
 
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+GuideS Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
 
S Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+GuideS Pii Plus+C+Library+Programmer+Guide
S Pii Plus+C+Library+Programmer+Guide
 
thesis
thesisthesis
thesis
 
ComPrep User Guide_v1
ComPrep User Guide_v1ComPrep User Guide_v1
ComPrep User Guide_v1
 
Magento designguide
Magento designguideMagento designguide
Magento designguide
 
Magento Design Guide
Magento Design GuideMagento Design Guide
Magento Design Guide
 
appserver.io tutorial
appserver.io tutorialappserver.io tutorial
appserver.io tutorial
 
Magento 2 Infinite Scroll
Magento 2 Infinite ScrollMagento 2 Infinite Scroll
Magento 2 Infinite Scroll
 
Siemens win cc manual win cc getting started
Siemens win cc manual win cc getting startedSiemens win cc manual win cc getting started
Siemens win cc manual win cc getting started
 
An introduction to weblogic console
An introduction to weblogic consoleAn introduction to weblogic console
An introduction to weblogic console
 
Certification study guide ibm tivoli access manager for e business 6.0 sg247202
Certification study guide ibm tivoli access manager for e business 6.0 sg247202Certification study guide ibm tivoli access manager for e business 6.0 sg247202
Certification study guide ibm tivoli access manager for e business 6.0 sg247202
 

Implementation Guide for Keepcon Content Moderation Services

  • 2. Index Index ................................................................................................................ 2 1 About this document ..................................................................................... 4 2 About the moderation process ........................................................................ 4 3 Integration Mechanisms ................................................................................. 5 3.1 Integration via REST ................................................................................ 5 3.1.1 Asynchronic integration method ........................................................... 5 3.1.1.1 Submitting / retrieving contents to moderate ................................... 5 3.1.1.1.1 XML submitting format ............................................................. 6 3.1.1.1.2 Reception confirmation ............................................................. 7 3.1.1.2 Retrieving moderation results ........................................................ 8 3.1.1.2.1 Moderation result XML format ................................................... 8 3.1.2 Synchronic integration method .......................................................... 10 3.2 Integration via API ................................................................................ 11 3.2.1 PHP API .......................................................................................... 12 3.2.1.1 API set-up ................................................................................. 12 3.2.1.2 API initialization ......................................................................... 12 3.2.1.3 Example of asynchronic moderation. ............................................. 12 3.2.1.4 Example of asynchronic reception ................................................. 14 3.2.1.5 Example of synchronic moderation ............................................... 15 3.2.1.6 Configuration file ........................................................................ 16 3.2.2 API Java ......................................................................................... 16 3.2.2.1 API use and examples ................................................................. 16 3.2.2.2 Configuration file ........................................................................ 16 3.3 Integration via Plugins ........................................................................... 17 3.3.1 Wordpress Plugin ............................................................................. 17 3.3.1.1 Wordpress plugin setup ............................................................... 17 3.3.1.2 Wordpress plugin configuration .................................................... 17 3.3.1.3 Plugin test ................................................................................. 20
  • 3. 3.3.2 Facebook plugin ............................................................................... 20 3.4 HTTPS protocol ..................................................................................... 20 4 Contents expiration ..................................................................................... 20 5 Remoderation and Moderation Mistakes ......................................................... 21 6 Following steps ........................................................................................... 21 7 Contact ...................................................................................................... 22 8 Appendix ................................................................................................... 23 8.1 Input XML for Rest service descriptive table .............................................. 23 8.2 Output XML descriptive table .................................................................. 25 8.3 Synchronic moderation output XML descriptive table .................................. 26 8.4 Descriptive table of the configuration file .................................................. 27
  • 4. 1 About this document This document provides the necessary information to use the moderation services provided by Keepcon. It is orientated to those people with technical skills in charge of the development and/or administration of a website. This document is grouped in sections, covering the moderation process and specific technical documentation on how to achieve a successful integration with your site. 2 About the moderation process Keepcon offers different types of moderation services, which are out of scope in this present document, but beyond which particular service has been hired, all of them include at least two operations: submitting contents to moderate and receiving an answer for the moderated contents. It is up to the clients to incorporate to their internal process the submittal of information to moderate, the retrieval of its results and the consequent actions on the basis of those results according to their own business rules. Version 5.0 January 2011 4
  • 5. 3 Integration Mechanisms 3.1 Integration via REST 3.1.1 Asynchronic integration method Asynchronic integration consists of performing operations of submitting content to moderate and the inquiry of moderated contents in different moments, without strict correlativity between them. In such a way, the client will have to implement two independent processes, one for each mentioned operation. Below, each operation is being described in detail, examples and steps to follow are provided to achieve a successful integration. 3.1.1.1 Submitting / retrieving contents to moderate Those contents to moderate should be submitted to Keepcon periodically and in sets (with its size to be defined according to volume and concrete needs) by the client. For example, if the average volume of content to moderate is around 1000 per hour, it would be necessary to submit sets of 50 elements every 3 minutes. Keepcon provides a REST service to which the client will submit the content set in XML format. The service URL is the following: http://service.keepcon.com/input/contentSet How to use the service: 1. Create the XML with the content in the format as detailed in section 3.1.1.1.1. 2. Invoke the service with a PUT HTTP by submitting the XML in the Request body. Basic-Authentication authentication method must be used with the user and password provided by Keepcon. 3. Read the service answer within the Response body, and verify if the submittal was carried out satisfactorily. Otherwise, retry submitting it. See section 3.1.1.1.2. Version 5.0 January 2011 5
  • 6. 3.1.1.1.1 XML submitting format The submitted set of contents to moderate must follow the following XML format: <?xml version="1.0" encoding="UTF-8" ?> <import> <contenttype>[account-name]</contenttype> <contents> <content id="1"> <author type="author">Jeff1989</author> <url_context><![CDATA[http://blog.keepcon.com/?p=143] ]></url_context> <datetime>1262304000000</datetime> <text><![CDATA[Hello my friends!!!]]></text> <img><![CDATA[http://mysite.com/somepic.jpg]]></img > <video><![CDATA[http://mysite.com/somevideo.flv]]></v ideo> </content> <content id="2"> <author type="author">Gandalf</author> <url_context><![CDATA[http://blog.keepcon.com/?p=142] ]></url_context> <datetime>1262304000000</datetime> <text><![CDATA[Hello everyone]]></text> <img><![CDATA[http://mysite.com/una- foto.jpg]]></img> <video><![CDATA[http://mysite.com/un- video.flv]]></video> </content> </contents> </import> Each XML element is detailed in section 8.1. Version 5.0 January 2011 6
  • 7. 3.1.1.1.2 Reception confirmation As a response to the submittal, Keepcon will send an answer confirming that the contents set was successfully received, together with the set identifier generated for that submittal. The response format will be the following. Positive reception response format. <?xml version="1.0" encoding="UTF-8" ?> <response> <setId>35</setId> <status>OK</status> </response> Negative reception response format. <?xml version="1.0" encoding="UTF-8" ?> <response> <status>ERROR</status> <errorMessage>Some parsing error message</errorMessage> </response> Keepcon generates a setId value for every set of content received successfully. . The client could use this number to do any type of tracking in its system. Important: It is very important to implement a retry mechanism. There is a possibility that due to an unexpected error or planned maintenance , the content reception service could fail. In those cases, the invoke process will have to detect the error code or lack of response, and should have to proceed to retry with some frequency until it is able to inject the contents into Keepcon platform. Version 5.0 January 2011 7
  • 8. 3.1.1.2 Retrieving moderation results Once the contents are processed, results will be available for the client. The client will periodically check the REST service to obtain the results for the moderated contents. The URL is the following: http://service.keepcon.com/output/contentSet?contextName=[account- name]&clientACK=true where [account-name] is the name of your company´s account. How to use the service: 1. Invoke the service with a PUT HTTP, submitting the account name opportunely provided by Keepcon as a parameter. Basic-Authentication method must be used with the user and password provided by Keepcon. 2. Read the service answer included in the Response body. The answer format is detailed in the following section. In case the answer is empty, it means there are no moderation results available to be checked. 3. Impact the moderation results according to your own business rules. 4. Send ACK to Keepcon: This ACK is used by Keepcon to finalize the Moderation cycle of each content. If client don’t send the ACK in the next 5 minutes, Keepcon will resend the same result set in the upcoming request. To send ACK you must call this REST service: http://service.keepcon.com:63081/output/contentSet/ack/[setId] where [setId] is the code of the result set which is inside the XML (see below) 3.1.1.2.1 Moderation result XML format Moderation results that are submitted to the client will have the following XML format: <?xml version="1.0" encoding="UTF-8"?> <export setId="3674"> <contents> <content id="1" > <moderatorName>moderator1</moderatorName> <moderationDate>1272973151662</moderationDate> <moderationDecision>REJECTED</moderationDecision> <tagging> Version 5.0 January 2011 8
  • 9. <tag>Inapropiated</tag> </tagging> </content> <content id="2" > <moderatorName>moderator1</moderatorName> <moderationDate>1272973151662</moderationDate> <moderationDecision>APPROVED</moderationDecision> <tagging/> </content> </contents> </export> Each XML element is detailed in section 7.2. Version 5.0 January 2011 9
  • 10. 3.1.2 Synchronic integration method In this scenario, the client will submit to Keepcon contents to moderate one by one, obtaining the moderation result synchronically for each submittal. For this purpose, Keepcon provides a REST service to submit the information. The URL is the following: http://sync.keepcon.com/synchronic/moderate/ How to use the service: 1. Create the XML with one content in the format detailed below. 2. Invoke the service with a PUT HTTP by including the XML in the Request body. Basic-Authentication method must be used with the user and password provided by Keepcon. 3. Read the service answer attached to the Response body, and verify if the operation was carried out successfully. See the XML response format detailed below. 4. Impact the moderation results according to your own business rules. Content to moderate should have the following XML format. <?xml version="1.0" encoding="UTF-8" ?> <import> <contenttype>[account-name]</contenttype> <contents> <content id="1"> <author type="author">Jhon1989</author> <url_context><![CDATA[http://blog.keepcon.com/?p=143] ]></url_context> <datetime>1262304000000</datetime> <text><![CDATA[Hello World!!!]]></text> </content> </contents> </root> Version 5.0 January 2011 10
  • 11. Note: in case the service receives more than one content to moderate in the same submittal, moderation will be cancelled and it will answer with ERROR status. As a response, the service will answer the moderation results in the following XML format: <?xml version="1.0" encoding="UTF-8"?> <response> <status>OK</status> <content id="1" > <moderationDecision>REJECTED</moderationDecision> <tagging> <tag>naked_bodies</tag> <tag>contact_information</tag> </tagging> </content> </response> Each XML element is detailed in section 7.3. Important: It is very important to implement a retry mechanism. There is a possibility that due to an unexpected error or planned maintenance, the content reception service could fail. In those cases, the invoke process will have to detect the error code or lack of response, and should have to proceed to retry with some frequency until it is able to inject the contents into Keepcon platform. 3.2 Integration via API It is possible to submit content to Keepcon´s server by using APIs available for PHP and Java languages, instead of using REST services. APIs are the integration method recommended by Keepcon because they are easier to use and they tend to minimize errors. Version 5.0 January 2011 11
  • 12. Through APIs it is possible to use both synchronic and asynchronic moderation mechanisms. Each API has an initialization file that is necessary to set up before starting the process. Before starting to use the API in the productive environment, it is important to coordinate with Keepcon´s technical staff those fields that will be included in the moderation process. 3.2.1 PHP API 3.2.1.1 API set-up To set-up PHP API, files included in keepcon-api-php.zip must be copied in a file accessible for the PHP code of your system. ZIP directory structure must be respected. If necessary, configuration variables of the file keepcon-client-api.ini could be modified (see 3.2.1.6) 3.2.1.2 API initialization The first step for the use of API is the initialization. This step has to be carried out for both asynchronic and synchronic calls. Initialization always has the following syntax: <?php require_once('../keepcon-client-api.php'); # The name of the Moderation Context and de Password should be provided by Keepcon technical team. $client = new KeepconClient('MyModerationContext', 'MyPassword', '/path/to/keepcon-client-api.ini'); … As it can be seen in the example, when creating the object KeepconClient, the name of the moderation context and its correspondent password has to be passed through parameters. Both the content type and the password must be requested to Keepcon´s technical staff (support@keepcon.com). It is possible for a company to use more than one moderation context. In that case, several KeepconClient must be initialized, one for each moderation context. 3.2.1.3 Example of asynchronic moderation. In this example, it is shown how to use the API to submit a set of content to be moderated in an asynchronic way. After initializing the API, all the contents that the client wants to submit should be put on a list. Each Moderation Context has its own field’s definition according to the needs of each company.. It is possible for a content to have fields of different types such as text, date, images and url. The structure defining field’s Version 5.0 January 2011 12
  • 13. quantity and types must be coordinated with Keepcon´s analysts. This structure will be aligned with moderation rules of each company. Once the content set is submitted, the object Response allows obtaining a token generated by Keepcon´s server, which we call “ticket number”. This ticket can be useful for error tracking in some circumstances. Finally, the submittal status can be checked to determine if it was successful or if there was some kind of error. In case of error, it is possible to obtain its message. These errors generally occur due to an error in the content field’s structure and if they appear, Keepcon´s technical staff should be contacted. In case an exception is thrown during the submittal, the recommended logic is to try it again latter. This only occurs when there is a connectivity problem or in case Keepcon´s service is undergoing maintenance. <?php require_once('../keepcon-client-api.php'); $client = new KeepconClient('ThisIsMyContextName', 'ThisIsMyPassword', '/path/to/keepcon-client-api.ini'); $contents = array(); # Add a content $content = new Content("1"); $content->add("comment", "This is the comment #1"); $content->add("author", "john"); $content->add("datetime", new DateTime()); array_push($contents, $content); # Add another content $content = new Content("2"); $content->add("comment", "This is the comment #2"); $content->add("author", "jules"); $content->add("datetime", new DateTime()); array_push($contents, $content); try { # Send the contents to keepcon $response = $client->send($contents); # Obtain the ticket number for tracking porpoise $ticket_id = $response->getTicketId(); # Check the response status to see if occur an error: if ($response->getStatus() == 'ERROR') { # TODO: Log the error and try again latter. This could be a format error. $error_message = $response->getErrorMessage(); } } catch (KeepconClientException $e) { # There was a connectivity error. } Version 5.0 January 2011 13
  • 14. ?> 3.2.1.4 Example of asynchronic reception This example shows how to retrieve moderation results. When retrieving these results, the API will bring sets of 50 results at the most. If there are fewer results available, then the API will bring a smaller set. In case there are no results left, the API will bring zero results. Once the API is initialized, the “results” method should be invoked and you should iterate for the “moderationResults” collection to obtain the result of each performed moderation. From each ModerationResult the element ID and the moderation result can be obtained to take action in your company system. Besides, additional information can be obtained as well, like the moderator´s name, moderation data and element´s Tags. Element’s Tags are used to relate the moderation policies of your company, for example: “bad words”, “nudity”, “contact information”, etc. Finally, you must send and ACK to Keepcon. This ACK is used by Keepcon to finalize the Moderation cycle of each content. If client don’t send the ACK in the next 5 minutes, Keepcon will resend the same result set in the upcoming request. <?php require_once('../keepcon-client-api.php'); $client = new KeepconClient('ThisIsMyContextName', 'ThisIsMyPassword', '../keepcon-client-api.ini'); try { $response = $client->results(); foreach ($response->getModerationResults() as $result) { # I can check moderation value for each element. $content_id = $result->getId(); $moderator_name = $result->getModeratorName(); $moderation_date = $result->getModerationDate(); $tags = $result->getTags(); #Check whether the element was approved, rejected or unknown. $moderation_decision = $result->getModerationDecision(); if ($moderation_decision == 'APPROVED') { # TODO: Approved element } elseif ($moderation_decision == 'REJECTED') { # TODO: Rejected element } elseif ($moderation_decision == 'UNKNOWN') { # TODO: Keepcon system was unable to take a moderation decision for this element } Version 5.0 January 2011 14
  • 15. } #Send ACK to Keepcon. if (count($response->getModerationResults())) { $client->ack_results($response->getTicketId()); } } catch (KeepconClientException $e) { # There was a connection problem } ?> 3.2.1.5 Example of synchronic moderation This example shows how to invoke the synchronic moderation service. After initializing the API, one content with its correspondent fields has to be created and submit it invoking the “send_sync” method. This method submits the content and brings the moderation result back. The moderation result is inside a ModerationResult object, from which the ID element and the moderation decision can be obtained to take action in the your sytem. Besides, additional information can be obtained as well, like the moderator´s name, moderation data and element´s TAGs. <?php require_once('../keepcon-client-api.php'); $client = new KeepconClient('ThisIsMyContextName', 'ThisIsMyPassword', '/path/to/keepcon-client-api.ini'); # Creo un content $content = new Content("1"); $content->add("comment", "This is comment #1"); $content->add("author", "john"); $content->add("datetime", new DateTime()); try { # Send the content $response = $client->send_sync($content); # If there was an error, you can check the message: if ($response->getStatus() == 'ERROR') { $error_message = $response->getErrorMessage(); } else { # Ticket id for tracking purpose $ticket_id = $response->getTicketId(); # Check the moderation result $result = $response->getModerationResult(); $content_id = $result->getId(); $moderator_name = $result->getModeratorName(); $moderation_date = $result->getModerationDate(); Version 5.0 January 2011 15
  • 16. $tags = $result->getTags(); $moderation_decision = $result->getModerationDecision(); if ($moderation_decision == 'APPROVED') { # TODO: Approved content } elseif ($moderation_decision == 'REJECTED') { # TODO: Rejected content } elseif ($moderation_decision == 'UNKNOWN') { # TODO: Keepcon system was unable to take a moderation decision for this element } } } catch (KeepconClientException $e) { # There was a connection problem } ?> 3.2.1.6 Configuration file keepcon-client-api.ini configuration file is configured with default values that in most cases are not necessary to modify. In chapter 5.4 all the variables that compose this file are detailed. 3.2.2 API Java The first step to start using API Java is to ask Keepcon´s technical staff for the JAR file that has the API java classes, use examples and documentation in Javadoc format. 3.2.2.1 API use and examples examples-api-java.zip file has available examples to perform synchronic and asynchronic moderations. These examples were developed taking into account real implementations from many of our clients. Therefore, this code can be used as template to start integration from scratch. It is only necessary to implement those actions in each moderation result: what to do in case of approving or rejecting an element in your system. 3.2.2.2 Configuration file keepcon-client-api.ini configuration file is configured with default values that in most cases are not necessary to modify. In chapter 5.4 all the variables that compose this configuration file are detailed. Version 5.0 January 2011 16
  • 17. 3.3 Integration via Plugins 3.3.1 Wordpress Plugin For those clients using Wordpress, the easiest way of integrating with Keepcon´s platform is through the installation and configuration of a plugin developed for that purpose. 3.3.1.1 Wordpress plugin setup To setup the plugin unzip keepcon-wordpress-plugin.zip into the folder “wp- content/plugins” of your Wordpress installation. Once unzipped, the plugin folder will have another folder inside called “keepcon”. After that, enter Wordpress plugins administration console, and a plugin called “Keepcon Moderation Plugin” should appear listed. To activate it, press the “Activate” link. 3.3.1.2 Wordpress plugin configuration After activating the plugin, it has to be configured. For that, enter the configuration screen by clicking “Keepcon Configuration” link that appears in “Settings” section. Version 5.0 January 2011 17
  • 18. When you click on Keepcon Configuration, the following plugin configuration screen will appear. Version 5.0 January 2011 18
  • 19. In this configuration screen, the only values which are necessary to modify are “Content Type” and “Password”. To request these values, send an e-mail to Keepcon´s technical staff (support@keepcon.com). You can also configure the plugin to operate in synchronic or asynchronic moderation modes. Version 5.0 January 2011 19
  • 20. . When using synchronic moderation, every user generated post will be immediately processed by Keepcon, while the asynchronic way will be executed every certain period of time. The HTTPS protocol can also be used for the information to travel through a safe channel. Finally, the use of a Proxy can be configured if needed. The remaining options must stay with the default values unless Keepcon´s technical staff requests some particular change. 3.3.1.3 Plugin test Before testing, get in touch with Keepcon´s technical staff to register the account with its correspondent moderation rules. Once the plugin is configured, the following steps can be tested: 1. Create an inappropriate message in the correspondent blog. 2. Verify that the message appears as published and that it also appears in Wordpress “Comments” screen. 3. After around 30 seconds, the comment should be eliminated from the blog and should appear in the “Trash” folder in “Comments” screen. That means the comment was automatically moderated and eliminated by Keepcon. 3.3.2 Facebook plugin Keepcon´s platform can import, moderate and eliminate comments and posts generated in Facebook Wall pages. To perform this integration, the only necessary thing is that the client grants Keepcon certain permissions inside Facebook account. The rest of the import process and messages deletion is performed automatically. It is not necessary to codify anything additional. To grant the requested permissions, ask Keepcon´s technical staff for the document “Keepcon – Instructions for Facebook permission grant”. 3.4 HTTPS protocol In order to achieve a better security for the contents transfer, Keepcon services can be used through HTTPS Protocol. All of the available integration methods (REST, PHP, Java, Wordpress and Facebook) can use this protocol. Keepcon´s technical staff should be contacted to receive instructions on how to use HTTPS. 4 Contents expiration Version 5.0 January 2011 20
  • 21. For those clients using our Manual Moderation Platform it is important to mention that all contents that Keepcon´s platform receives have a default expiration of 15 days. That is to say, if content is submitted and, during 15 days, this content is not manually moderated, it will be marked as expired and will be discarded from our system. The only way of moderating it will be by resending it. In case a longer expiration is needed, it has to be requested to Keepcon´s technical staff. 5 Remoderation and Moderation Mistakes In some situations it is possible a single content to be moderated twice so your system may receive two different results for the same content in different moments. For example, you may receive a REJECTED result for content_id =”133” and the next day you receive an APPROVED result for the same content_id. This situation is used to happen when a manual or automatic moderation mistake occurs and a revision action is done. So our recommendation is that your system should be prepared to handle this situation and it would be able to impact a new result for the same content_id. But this is only a suggestion and it is up to your business rules. 6 Following steps Once the integration between the client´s system and Keepcon´s platform is finished, we recommend following these steps: • Verify the correct import of contents: Ask for a user and a password to enter the platform (http://platform.keepcon.com) and visually verify that the contents appear as “pending for moderation”. It is important to submit contents that are not automatically moderated during this first step. • Verify the correct export of results: Once the contents are visible in the platform, they have to be manually moderated by choosing different moderation criteria, for example, rejecting and approving contents by choosing different tags. After that, execute the code that gets the results and verify that the received values are the correct ones. • Try the platform´s “Contents Administrator” to know how to search for historical elements. • Try our Reports & BI Tool in http://tools.keepcon.com/sites/reports. This tool helps to visualize statistical graphics with useful information for people responsible of your site. This information is updated approximately every 3 hours. Version 5.0 January 2011 21
  • 22. 7 Contact If you have any request or inquiry, you can contact Keepcon´s staff, that will guide you during the integration process: • E-mail: support@keepcon.com Version 5.0 January 2011 22
  • 23. 8 Appendix 8.1 Input XML for Rest service descriptive table Each of the elements of this XML is described in the following table. Schema is also available for performing validation before submitting content to Keepcon. If needed, ask for the schema (XSD file) to Keepcon´s technical staff. Some elements of the XML can be customized to satisfy client’s needs. Element / Type of piece of Description Required attribute information setId Attribute. String Import lot identifier, generated by No. the client. contenttype Element. String This element has the context Yes. name assigned to the client. This value is immutable and will be provided by Keepcon. contents Element. This element has multiple content Yes. type child elements, with the contents to be moderated. content Element. Content to moderate. Yes. id Attribute. Entire long Only content identifier provided by Yes. positive. the client. author Element. Chain. Name of the content´s author. No, but This piece of information is not suggested. obligatory if the client is not interested in performing a follow- up per user. It is suggested to provide it anyway since the moderation process is more efficient taking this type of information into account. Version 5.0 January 2011 23
  • 24. Element / Type of piece of Description Required attribute information url_context Element. String. URL where the content is. The No, but purpose of this is to visualize the suggested. content in its context to disambiguate it in case of doubt. datetime Element. Format UTC Content creation date and time in No, but in milliseconds. order to use the chronological suggested. order in the moderation queue prioritization whether it is a pre- moderation or a post-moderation model. type Attribute. String. Internal for the platform. Type of Yes. field information. text Element. String. Content to moderate. Yes. Note: always write the content between <![CDATA[]]>, to avoid strange characters preventing from the correct use of the content. img Element. String. URL aiming to the image to No. moderate. Formats: GIF, JPG, PNG and BMP. video Element. String. URL aiming to the video to No. moderate. Note: Keepcon can practically manage any type of standard video format, but to convert it to FLV, it internally processes it, so if it is originally submitted as FLV, the moderation process efficiency notably improves, positively impacting on the response times. Version 5.0 January 2011 24
  • 25. 8.2 Output XML descriptive table Each of the elements of this XML is described in the following table. Element / Type of piece of Description attribute information setId Attribute. Entire long In order to carry out a proper positive. follow-up of the moderation results submittal, Keepcon will generate a unique identifier for each group of submitted results. contents Element. This element has multiple content type child elements. content Element. A specific content. id Attribute. Entire long Unique identifier of the UGC. positive. moderationDecision Attribute. String. Shows the content moderation decision. Possible values are: • REJECTED • APPROVED • UNKNOWN tagging Element. List of rejection reasons resulting from the content moderation process. In case the content has an approved status, the list of rejection reasons will be empty. Version 5.0 January 2011 25
  • 26. Element / Type of piece of Description attribute information tag Element. String. Content categorization resulting from the moderation process. Values will be defined for each client according to their moderation rules. 8.3 Synchronic moderation output XML descriptive table Each of the elements of this XML is described in the following table. Element / Type of piece of Description attribute information status Element. String. It indicates if the request was processed or not. Possible values are: • OK • ERROR content Element. A particular content. id Attribute. Entire long Unique identifier of the client positive. generated content. moderationDecision Element. String. Shows the content moderation decision. Possible values are: • REJECTED • APPROVED • UNKNOWN tagging Element. List of reject reasons as a consequence of the content moderation process. In case the content has an approved status, the list of reject reasons will be empty. Version 5.0 January 2011 26
  • 27. Element / Type of piece of Description attribute information tag Element. String. Content categorization as a consequence of the moderation process. Values will be defined according to each client´s moderation rules. 8.4 Descriptive table of the configuration file The API configuration file has the following variables. Most of the variables do not need to modify the default values. But it is important to understand the functioning of each of them. Section Name Default Description keepcon_settings keepcon_async_url http://service.keepcon.com/inp URL of the Keepcon service to ut/contentSet submit contents to moderate in an asynchronic way using protocol HTTP. This value should not be modified unless requested by Keepcon technicians. To use HTTPS the url with https:// must be used. keepcon_settings keepcon_async_results_ http://service.keepcon.com/out URL of the Keepcon service to url put/contentSet?contextName= obtain the results from asynchronic moderations by using protocol HTTP. This value should not be modified unless requested by Keepcon technicians. To use HTTPS the url with https:// must be used. keepcon_settings keepcon_async_ack_url http://service.keepcon.com:630 URL of the keepcon service to 81/output/contentSet/ack/ submit ACK. Do not change this value. keepcon_settings keepcon_sync_url http://sync.keepcon.com/synch URL of the Keepcon service to ronic/moderate/ moderate contents in a synchronic way. This value should not be modified unless requested by Keepcon technicians. keepcon_settings author_element_name author For Keepcon´s internal use. connection_settings client_timeout 60 Timeout in seconds to carry out the information transfers. Possibly, it will be necessary to adjust this value depending on the lengths of the texts to moderate and the conditions of the client´s network. Version 5.0 January 2011 27
  • 28. connection_settings send_retries 3 Number of retries when facing a connection problem or packages lost. This value should not be modified unless requested by Keepcon technicians. connection_settings http_adapter 'HTTP_Request2_Adapter_Sock Implementation of the adapter et' used by the client to connect to Keepcon´s server. Values it may take are: 'HTTP_Request2_Adapter_Socket' o 'HTTP_Request2_Adapter_Curl'. Just for PHP. connection_settings proxy_host If it is necessary to use a proxy, these values should be filled. connection_settings proxy_port If it is necessary to use a proxy, these values should be filled. connection_settings proxy_user If it is necessary to use a proxy, these values should be filled. connection_settings proxy_password If it is necessary to use a proxy, these values should be filled. connection_settings proxy_auth_scheme If it is necessary to use a proxy, these values should be filled: "basic" o "digest". logging log_file /tmp/keepcon.log Directory where the API will generate the log file. The file will only be generated if the log is activated. Just for PHP. logging debug False Indicates the API to generate Debug information in a log file. It is useful just in special circumstances where errors want to be detected. logging trace False Indicates the API to generate Debug information in a more detailed way. It is useful just in special circumstances where errors want to be detected. development development False If it is switched to True, requests are not send to Keepcon´s server but a false response is generated. internal_options ssl_verify_peer False It indicates if Keepcon´s SSL certificate is verified. Only modify this value if requested by Keepcon´s support staff. Just for PHP. internal_options ssl_verify_host False It indicates if the identity of Keepcon´s SSL certifícate host is verified. Only modify this value if requested by Keepcon´s support Version 5.0 January 2011 28
  • 29. staff. Just for PHP. internal_options follow_redirects False It indicates the http connector if it should follow the redirects sent by the server. If http_adapter is used = 'HTTP_Request2_Adapter_Curl' set this variable in True. Version 5.0 January 2011 29