SlideShare uma empresa Scribd logo
1 de 29
Baixar para ler offline
Version 6.0
April 2013 1
Implementation Guide
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 Tips & Troubleshooting ................................................................................ 21
8 Contact...................................................................................................... 22
9 Appendix ................................................................................................... 23
9.1 Input XML for Rest service descriptive table.............................................. 23
9.2 Output XML descriptive table .................................................................. 25
9.3 Synchronic moderation output XML descriptive table.................................. 26
9.4 Descriptive table of the configuration file.................................................. 27
Version 6.0
April 2013 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 6.0
April 2013 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 6.0
April 2013 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 9.1.
Version 6.0
April 2013 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 6.0
April 2013 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/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 6.0
April 2013 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 6.0
April 2013 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 6.0
April 2013 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 6.0
April 2013 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 6.0
April 2013 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 6.0
April 2013 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 6.0
April 2013 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 6.0
April 2013 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 6.0
April 2013 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 6.0
April 2013 18
When you click on Keepcon Configuration, the following plugin configuration
screen will appear.
Version 6.0
April 2013 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 6.0
April 2013 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.
4 Contents expiration
For those clients using our Manual Moderation Platform it is important to
mention that all contents that Keepcon´s platform receives have a default
Version 6.0
April 2013 21
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.
It is possible to require a default moderation result for expired content. For
example we can approve all content that not moderated for 15 days.
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.
7 Tips & Troubleshooting
Version 6.0
April 2013 22
 Timeouts: All API Requests should return in less than 1 second, but we
recommend setting both connection and socket timeout between 10 and
30 seconds.
 HTTP Header: If you are using REST integration, then you should add the
following http header to all requests: “User-Agent”=” Keepcon Client API
REST v1.0 - Context Name: [contextName]“ where contextName is the
name of the context you are using.
 Service Status: To check the service health, you should go to
http://status.keepcon.com.
 Alarms: Some customers need to be aware of critical situations. So we
can configure alarms to send emails when: we receive too low or too
much traffic, we detect certain level of automatic or manual decisions,
we detect certain level of rejected or approved content. If you need any
of these alarms you should ask them to our technical team.
 Latency: In case you need a very low latency (less than 1 second) then
you should contact our technical team in order to setup a particular
configuration. For example, we can give you direct access to our Dallas,
Washington DC or Amsterdam servers.
 XML Format: It is important to use CDATA sections inside XML fields.
CDATA should not has other CDATA inside nor “]]>” strings.
8 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 6.0
April 2013 23
9 Appendix
9.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 /
attribute
Type of piece of
information
Description Required
setId Attribute. String Import lot identifier, generated by
the client.
No.
contenttype Element. String This element has the context
name assigned to the client.
This value is immutable and will
be provided by Keepcon.
Yes.
contents Element. This element has multiple content
type child elements, with the
contents to be moderated.
Yes.
content Element. Content to moderate. Yes.
id Attribute. Entire long
positive.
Only content identifier provided by
the client.
Yes.
author Element. Chain. Name of the content´s author.
This piece of information is not
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.
No, but
suggested.
Version 6.0
April 2013 24
Element /
attribute
Type of piece of
information
Description Required
url_context Element. String. URL where the content is. The
purpose of this is to visualize the
content in its context to
disambiguate it in case of doubt.
No, but
suggested.
datetime Element. Format UTC
in milliseconds.
Content creation date and time in
order to use the chronological
order in the moderation queue
prioritization whether it is a pre-
moderation or a post-moderation
model.
No, but
suggested.
type Attribute. String. Internal for the platform. Type of
field information.
Yes.
text Element. String. Content to moderate.
Note: always write the content
between <![CDATA[]]>, to avoid
strange characters preventing
from the correct use of the
content.
Yes.
img Element. String. URL aiming to the image to
moderate.
Formats: GIF, JPG, PNG and BMP.
No.
video Element. String. URL aiming to the video to
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.
No.
Version 6.0
April 2013 25
9.2 Output XML descriptive table
Each of the elements of this XML is described in the following table.
Element /
attribute
Type of piece of
information
Description
setId Attribute. Entire long
positive.
In order to carry out a proper
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
positive.
Unique identifier of the UGC.
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 6.0
April 2013 26
Element /
attribute
Type of piece of
information
Description
tag Element. String. Content categorization resulting
from the moderation process.
Values will be defined for each
client according to their
moderation rules.
9.3 Synchronic moderation output XML descriptive table
Each of the elements of this XML is described in the following table.
Element /
attribute
Type of piece of
information
Description
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
positive.
Unique identifier of the client
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 6.0
April 2013 27
Element /
attribute
Type of piece of
information
Description
tag Element. String. Content categorization as a
consequence of the moderation
process. Values will be defined
according to each client´s
moderation rules.
9.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
ut/contentSet
URL of the Keepcon service to
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_
url
http://service.keepcon.com/out
put/contentSet?contextName=
URL of the Keepcon service to
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
/ack/
URL of the keepcon service to
submit ACK. Do not change this
value.
keepcon_settings keepcon_sync_url http://sync.keepcon.com/synch
ronic/moderate/
URL of the Keepcon service to
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 6.0
April 2013 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
et'
Implementation of the adapter
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 6.0
April 2013 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.

Mais conteúdo relacionado

Destaque (6)

Self Powerpoint
Self PowerpointSelf Powerpoint
Self Powerpoint
 
Keepcon integrations- en-
Keepcon integrations- en-Keepcon integrations- en-
Keepcon integrations- en-
 
Keepcon integration tutorial (December 2013)
Keepcon integration tutorial (December 2013)Keepcon integration tutorial (December 2013)
Keepcon integration tutorial (December 2013)
 
Tratraball
TratraballTratraball
Tratraball
 
Ideation
IdeationIdeation
Ideation
 
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 Keepcon integration tutorial_en (abril 2013)

FINAL PROJECT REPORT1
FINAL PROJECT REPORT1FINAL PROJECT REPORT1
FINAL PROJECT REPORT1
waqar younas
 
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
BaasanjargalBaynmunk
 
multi-vendor-catering-management-sytem.docx
multi-vendor-catering-management-sytem.docxmulti-vendor-catering-management-sytem.docx
multi-vendor-catering-management-sytem.docx
veerdevshreyas1
 

Semelhante a Keepcon integration tutorial_en (abril 2013) (20)

Oracle OSB Tutorial 2
Oracle OSB Tutorial 2Oracle OSB Tutorial 2
Oracle OSB Tutorial 2
 
White_Paper_on_Oracle_Internet_Expenses_Setup_and_Functional_Process_Flow.pdf
White_Paper_on_Oracle_Internet_Expenses_Setup_and_Functional_Process_Flow.pdfWhite_Paper_on_Oracle_Internet_Expenses_Setup_and_Functional_Process_Flow.pdf
White_Paper_on_Oracle_Internet_Expenses_Setup_and_Functional_Process_Flow.pdf
 
Inter process communication
Inter process communicationInter process communication
Inter process communication
 
HDFC banking system SRS Document
HDFC banking system  SRS DocumentHDFC banking system  SRS Document
HDFC banking system SRS Document
 
SRS CPP LAB.docx
SRS CPP LAB.docxSRS CPP LAB.docx
SRS CPP LAB.docx
 
FINAL PROJECT REPORT1
FINAL PROJECT REPORT1FINAL PROJECT REPORT1
FINAL PROJECT REPORT1
 
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
 
Vat exempt magento 2
Vat exempt magento  2Vat exempt magento  2
Vat exempt magento 2
 
Pandora FMS: End to End Exchange Plugin
Pandora FMS: End to End Exchange PluginPandora FMS: End to End Exchange Plugin
Pandora FMS: End to End Exchange Plugin
 
multi-vendor-catering-management-sytem.docx
multi-vendor-catering-management-sytem.docxmulti-vendor-catering-management-sytem.docx
multi-vendor-catering-management-sytem.docx
 
Acceptance test plan_4-24-07
Acceptance test plan_4-24-07Acceptance test plan_4-24-07
Acceptance test plan_4-24-07
 
Lease approval workflow_white_paper
Lease approval workflow_white_paperLease approval workflow_white_paper
Lease approval workflow_white_paper
 
Microsoft 365 Audit Log Reports - M365 Learning Document
Microsoft 365 Audit Log Reports - M365 Learning DocumentMicrosoft 365 Audit Log Reports - M365 Learning Document
Microsoft 365 Audit Log Reports - M365 Learning Document
 
Everything to Know About React Re-Rendering: A Comprehensive Guide
Everything to Know About React Re-Rendering: A Comprehensive GuideEverything to Know About React Re-Rendering: A Comprehensive Guide
Everything to Know About React Re-Rendering: A Comprehensive Guide
 
Pandora FMS: Blackberry Exchange Monitoring
Pandora FMS: Blackberry Exchange MonitoringPandora FMS: Blackberry Exchange Monitoring
Pandora FMS: Blackberry Exchange Monitoring
 
How to develop a gateway service using code based implementation
How to develop a gateway service using code based implementationHow to develop a gateway service using code based implementation
How to develop a gateway service using code based implementation
 
Template de acordo de nível de serviço
Template de acordo de nível de serviçoTemplate de acordo de nível de serviço
Template de acordo de nível de serviço
 
Report
ReportReport
Report
 
Document Consistency Checker(2)
Document Consistency Checker(2)Document Consistency Checker(2)
Document Consistency Checker(2)
 
Template de acordo de nível de serviço
Template de acordo de nível de serviçoTemplate de acordo de nível de serviço
Template de acordo de nível de serviço
 

Último

+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 

Último (20)

AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024
 
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu SubbuApidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 

Keepcon integration tutorial_en (abril 2013)

  • 1. Version 6.0 April 2013 1 Implementation Guide
  • 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 Tips & Troubleshooting ................................................................................ 21 8 Contact...................................................................................................... 22 9 Appendix ................................................................................................... 23 9.1 Input XML for Rest service descriptive table.............................................. 23 9.2 Output XML descriptive table .................................................................. 25 9.3 Synchronic moderation output XML descriptive table.................................. 26 9.4 Descriptive table of the configuration file.................................................. 27
  • 4. Version 6.0 April 2013 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.
  • 5. Version 6.0 April 2013 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.
  • 6. Version 6.0 April 2013 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 9.1.
  • 7. Version 6.0 April 2013 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.
  • 8. Version 6.0 April 2013 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/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>
  • 9. Version 6.0 April 2013 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.
  • 10. Version 6.0 April 2013 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>
  • 11. Version 6.0 April 2013 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.
  • 12. Version 6.0 April 2013 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
  • 13. Version 6.0 April 2013 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. }
  • 14. Version 6.0 April 2013 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 }
  • 15. Version 6.0 April 2013 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();
  • 16. Version 6.0 April 2013 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.
  • 17. Version 6.0 April 2013 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.
  • 18. Version 6.0 April 2013 18 When you click on Keepcon Configuration, the following plugin configuration screen will appear.
  • 19. Version 6.0 April 2013 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.
  • 20. Version 6.0 April 2013 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. 4 Contents expiration For those clients using our Manual Moderation Platform it is important to mention that all contents that Keepcon´s platform receives have a default
  • 21. Version 6.0 April 2013 21 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. It is possible to require a default moderation result for expired content. For example we can approve all content that not moderated for 15 days. 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. 7 Tips & Troubleshooting
  • 22. Version 6.0 April 2013 22  Timeouts: All API Requests should return in less than 1 second, but we recommend setting both connection and socket timeout between 10 and 30 seconds.  HTTP Header: If you are using REST integration, then you should add the following http header to all requests: “User-Agent”=” Keepcon Client API REST v1.0 - Context Name: [contextName]“ where contextName is the name of the context you are using.  Service Status: To check the service health, you should go to http://status.keepcon.com.  Alarms: Some customers need to be aware of critical situations. So we can configure alarms to send emails when: we receive too low or too much traffic, we detect certain level of automatic or manual decisions, we detect certain level of rejected or approved content. If you need any of these alarms you should ask them to our technical team.  Latency: In case you need a very low latency (less than 1 second) then you should contact our technical team in order to setup a particular configuration. For example, we can give you direct access to our Dallas, Washington DC or Amsterdam servers.  XML Format: It is important to use CDATA sections inside XML fields. CDATA should not has other CDATA inside nor “]]>” strings. 8 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
  • 23. Version 6.0 April 2013 23 9 Appendix 9.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 / attribute Type of piece of information Description Required setId Attribute. String Import lot identifier, generated by the client. No. contenttype Element. String This element has the context name assigned to the client. This value is immutable and will be provided by Keepcon. Yes. contents Element. This element has multiple content type child elements, with the contents to be moderated. Yes. content Element. Content to moderate. Yes. id Attribute. Entire long positive. Only content identifier provided by the client. Yes. author Element. Chain. Name of the content´s author. This piece of information is not 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. No, but suggested.
  • 24. Version 6.0 April 2013 24 Element / attribute Type of piece of information Description Required url_context Element. String. URL where the content is. The purpose of this is to visualize the content in its context to disambiguate it in case of doubt. No, but suggested. datetime Element. Format UTC in milliseconds. Content creation date and time in order to use the chronological order in the moderation queue prioritization whether it is a pre- moderation or a post-moderation model. No, but suggested. type Attribute. String. Internal for the platform. Type of field information. Yes. text Element. String. Content to moderate. Note: always write the content between <![CDATA[]]>, to avoid strange characters preventing from the correct use of the content. Yes. img Element. String. URL aiming to the image to moderate. Formats: GIF, JPG, PNG and BMP. No. video Element. String. URL aiming to the video to 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. No.
  • 25. Version 6.0 April 2013 25 9.2 Output XML descriptive table Each of the elements of this XML is described in the following table. Element / attribute Type of piece of information Description setId Attribute. Entire long positive. In order to carry out a proper 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 positive. Unique identifier of the UGC. 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.
  • 26. Version 6.0 April 2013 26 Element / attribute Type of piece of information Description tag Element. String. Content categorization resulting from the moderation process. Values will be defined for each client according to their moderation rules. 9.3 Synchronic moderation output XML descriptive table Each of the elements of this XML is described in the following table. Element / attribute Type of piece of information Description 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 positive. Unique identifier of the client 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.
  • 27. Version 6.0 April 2013 27 Element / attribute Type of piece of information Description tag Element. String. Content categorization as a consequence of the moderation process. Values will be defined according to each client´s moderation rules. 9.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 ut/contentSet URL of the Keepcon service to 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_ url http://service.keepcon.com/out put/contentSet?contextName= URL of the Keepcon service to 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 /ack/ URL of the keepcon service to submit ACK. Do not change this value. keepcon_settings keepcon_sync_url http://sync.keepcon.com/synch ronic/moderate/ URL of the Keepcon service to 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.
  • 28. Version 6.0 April 2013 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 et' Implementation of the adapter 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
  • 29. Version 6.0 April 2013 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.