http://git-wip-us.apache.org/repos/asf/incubator-predictionio-site/blob/4e7d331e/datacollection/eventapi/index.html
----------------------------------------------------------------------
diff --git a/datacollection/eventapi/index.html 
b/datacollection/eventapi/index.html
new file mode 100644
index 0000000..ac2f4a9
--- /dev/null
+++ b/datacollection/eventapi/index.html
@@ -0,0 +1,293 @@
+<!DOCTYPE html><html><head><title>Collecting Data through 
REST/SDKs</title><meta charset="utf-8"/><meta content="IE=edge,chrome=1" 
http-equiv="X-UA-Compatible"/><meta name="viewport" 
content="width=device-width, initial-scale=1.0"/><meta class="swiftype" 
name="title" data-type="string" content="Collecting Data through 
REST/SDKs"/><link rel="canonical" 
href="https://predictionio.incubator.apache.org/datacollection/eventapi/"/><link
 href="/images/favicon/normal-b330020a.png" rel="shortcut icon"/><link 
href="/images/favicon/apple-c0febcf2.png" rel="apple-touch-icon"/><link 
href="//fonts.googleapis.com/css?family=Open+Sans:300italic,400italic,600italic,700italic,800italic,400,300,600,700,800"
 rel="stylesheet"/><link 
href="//maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css" 
rel="stylesheet"/><link href="/stylesheets/application-eccfc6cb.css" 
rel="stylesheet" type="text/css"/><script 
src="//cdnjs.cloudflare.com/ajax/libs/html5shiv/3.7.2/html5shiv.min.js"></script><scrip
 t 
src="//cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script><script
 src="//use.typekit.net/pqo0itb.js"></script><script>try{Typekit.load({ async: 
true });}catch(e){}</script></head><body><div id="global"><header><div 
class="container" id="header-wrapper"><div class="row"><div 
class="col-sm-12"><div id="logo-wrapper"><span id="drawer-toggle"></span><a 
href="#"></a><a href="http://predictionio.incubator.apache.org/";><img 
alt="PredictionIO" id="logo" 
src="/images/logos/logo-ee2b9bb3.png"/></a><span>™</span></div><div 
id="menu-wrapper"><div id="pill-wrapper"><a class="pill left" 
href="/gallery/template-gallery">TEMPLATES</a> <a class="pill right" 
href="//github.com/apache/incubator-predictionio/">OPEN 
SOURCE</a></div></div><img class="mobile-search-bar-toggler hidden-md 
hidden-lg" 
src="/images/icons/search-glass-704bd4ff.png"/></div></div></div></header><div 
id="search-bar-row-wrapper"><div class="container-fluid" 
id="search-bar-row"><div class="row"><div
  class="col-md-9 col-sm-11 col-xs-11"><div class="hidden-md hidden-lg" 
id="mobile-page-heading-wrapper"><p>PredictionIO Docs</p><h4>Collecting Data 
with REST/SDKs</h4></div><h4 class="hidden-sm hidden-xs">PredictionIO 
Docs</h4></div><div class="col-md-3 col-sm-1 col-xs-1 hidden-md hidden-lg"><img 
id="left-menu-indicator" 
src="/images/icons/down-arrow-dfe9f7fe.png"/></div><div class="col-md-3 
col-sm-12 col-xs-12 swiftype-wrapper"><div class="swiftype"><form 
class="search-form"><img class="search-box-toggler hidden-xs hidden-sm" 
src="/images/icons/search-glass-704bd4ff.png"/><div class="search-box"><img 
src="/images/icons/search-glass-704bd4ff.png"/><input type="text" 
id="st-search-input" class="st-search-input" placeholder="Search 
Doc..."/></div><img class="swiftype-row-hider hidden-md hidden-lg" 
src="/images/icons/drawer-toggle-active-fcbef12a.png"/></form></div></div><div 
class="mobile-left-menu-toggler hidden-md 
hidden-lg"></div></div></div></div><div id="page" class="container-fl
 uid"><div class="row"><div id="left-menu-wrapper" class="col-md-3"><nav 
id="nav-main"><ul><li class="level-1"><a class="expandible" 
href="/"><span>Apache PredictionIO™ (incubating) 
Documentation</span></a><ul><li class="level-2"><a class="final" 
href="/"><span>Welcome to Apache PredictionIO 
(incubating)</span></a></li></ul></li><li class="level-1"><a class="expandible" 
href="#"><span>Getting Started</span></a><ul><li class="level-2"><a 
class="final" href="/start/"><span>A Quick Intro</span></a></li><li 
class="level-2"><a class="final" href="/install/"><span>Installing Apache 
PredictionIO (incubating)</span></a></li><li class="level-2"><a class="final" 
href="/start/download/"><span>Downloading an Engine Template</span></a></li><li 
class="level-2"><a class="final" href="/start/deploy/"><span>Deploying Your 
First Engine</span></a></li><li class="level-2"><a class="final" 
href="/start/customize/"><span>Customizing the 
Engine</span></a></li></ul></li><li class="level-1"><a class="expan
 dible" href="#"><span>Integrating with Your App</span></a><ul><li 
class="level-2"><a class="final" href="/appintegration/"><span>App Integration 
Overview</span></a></li><li class="level-2"><a class="expandible" 
href="/sdk/"><span>List of SDKs</span></a><ul><li class="level-3"><a 
class="final" href="/sdk/java/"><span>Java & Android SDK</span></a></li><li 
class="level-3"><a class="final" href="/sdk/php/"><span>PHP 
SDK</span></a></li><li class="level-3"><a class="final" 
href="/sdk/python/"><span>Python SDK</span></a></li><li class="level-3"><a 
class="final" href="/sdk/ruby/"><span>Ruby SDK</span></a></li><li 
class="level-3"><a class="final" href="/sdk/community/"><span>Community Powered 
SDKs</span></a></li></ul></li></ul></li><li class="level-1"><a 
class="expandible" href="#"><span>Deploying an Engine</span></a><ul><li 
class="level-2"><a class="final" href="/deploy/"><span>Deploying as a Web 
Service</span></a></li><li class="level-2"><a class="final" 
href="/batchpredict/"><span>Batch P
 redictions</span></a></li><li class="level-2"><a class="final" 
href="/deploy/monitoring/"><span>Monitoring Engine</span></a></li><li 
class="level-2"><a class="final" href="/deploy/engineparams/"><span>Setting 
Engine Parameters</span></a></li><li class="level-2"><a class="final" 
href="/deploy/enginevariants/"><span>Deploying Multiple Engine 
Variants</span></a></li><li class="level-2"><a class="final" 
href="/deploy/plugin/"><span>Engine Server Plugin</span></a></li></ul></li><li 
class="level-1"><a class="expandible" href="#"><span>Customizing an 
Engine</span></a><ul><li class="level-2"><a class="final" 
href="/customize/"><span>Learning DASE</span></a></li><li class="level-2"><a 
class="final" href="/customize/dase/"><span>Implement DASE</span></a></li><li 
class="level-2"><a class="final" 
href="/customize/troubleshooting/"><span>Troubleshooting Engine 
Development</span></a></li><li class="level-2"><a class="final" 
href="/api/current/#package"><span>Engine Scala APIs</span></a></li></ul>
 </li><li class="level-1"><a class="expandible" href="#"><span>Collecting and 
Analyzing Data</span></a><ul><li class="level-2"><a class="final" 
href="/datacollection/"><span>Event Server Overview</span></a></li><li 
class="level-2"><a class="final active" 
href="/datacollection/eventapi/"><span>Collecting Data with 
REST/SDKs</span></a></li><li class="level-2"><a class="final" 
href="/datacollection/eventmodel/"><span>Events Modeling</span></a></li><li 
class="level-2"><a class="final" 
href="/datacollection/webhooks/"><span>Unifying Multichannel Data with 
Webhooks</span></a></li><li class="level-2"><a class="final" 
href="/datacollection/channel/"><span>Channel</span></a></li><li 
class="level-2"><a class="final" 
href="/datacollection/batchimport/"><span>Importing Data in 
Batch</span></a></li><li class="level-2"><a class="final" 
href="/datacollection/analytics/"><span>Using Analytics 
Tools</span></a></li><li class="level-2"><a class="final" 
href="/datacollection/plugin/"><span>Event Server 
 Plugin</span></a></li></ul></li><li class="level-1"><a class="expandible" 
href="#"><span>Choosing an Algorithm(s)</span></a><ul><li class="level-2"><a 
class="final" href="/algorithm/"><span>Built-in Algorithm 
Libraries</span></a></li><li class="level-2"><a class="final" 
href="/algorithm/switch/"><span>Switching to Another 
Algorithm</span></a></li><li class="level-2"><a class="final" 
href="/algorithm/multiple/"><span>Combining Multiple 
Algorithms</span></a></li><li class="level-2"><a class="final" 
href="/algorithm/custom/"><span>Adding Your Own 
Algorithms</span></a></li></ul></li><li class="level-1"><a class="expandible" 
href="#"><span>ML Tuning and Evaluation</span></a><ul><li class="level-2"><a 
class="final" href="/evaluation/"><span>Overview</span></a></li><li 
class="level-2"><a class="final" 
href="/evaluation/paramtuning/"><span>Hyperparameter Tuning</span></a></li><li 
class="level-2"><a class="final" 
href="/evaluation/evaluationdashboard/"><span>Evaluation Dashboard</span></a></
 li><li class="level-2"><a class="final" 
href="/evaluation/metricchoose/"><span>Choosing Evaluation 
Metrics</span></a></li><li class="level-2"><a class="final" 
href="/evaluation/metricbuild/"><span>Building Evaluation 
Metrics</span></a></li></ul></li><li class="level-1"><a class="expandible" 
href="#"><span>System Architecture</span></a><ul><li class="level-2"><a 
class="final" href="/system/"><span>Architecture Overview</span></a></li><li 
class="level-2"><a class="final" href="/system/anotherdatastore/"><span>Using 
Another Data Store</span></a></li></ul></li><li class="level-1"><a 
class="expandible" href="#"><span>PredictionIO Official 
Templates</span></a><ul><li class="level-2"><a class="final" 
href="/templates/"><span>Intro</span></a></li><li class="level-2"><a 
class="expandible" href="#"><span>Recommendation</span></a><ul><li 
class="level-3"><a class="final" 
href="/templates/recommendation/quickstart/"><span>Quick 
Start</span></a></li><li class="level-3"><a class="final" href="/tem
 plates/recommendation/dase/"><span>DASE</span></a></li><li class="level-3"><a 
class="final" href="/templates/recommendation/evaluation/"><span>Evaluation 
Explained</span></a></li><li class="level-3"><a class="final" 
href="/templates/recommendation/how-to/"><span>How-To</span></a></li><li 
class="level-3"><a class="final" 
href="/templates/recommendation/reading-custom-events/"><span>Read Custom 
Events</span></a></li><li class="level-3"><a class="final" 
href="/templates/recommendation/customize-data-prep/"><span>Customize Data 
Preparator</span></a></li><li class="level-3"><a class="final" 
href="/templates/recommendation/customize-serving/"><span>Customize 
Serving</span></a></li><li class="level-3"><a class="final" 
href="/templates/recommendation/training-with-implicit-preference/"><span>Train 
with Implicit Preference</span></a></li><li class="level-3"><a class="final" 
href="/templates/recommendation/blacklist-items/"><span>Filter Recommended 
Items by Blacklist in Query</span></a></li><
 li class="level-3"><a class="final" 
href="/templates/recommendation/batch-evaluator/"><span>Batch Persistable 
Evaluator</span></a></li></ul></li><li class="level-2"><a class="expandible" 
href="#"><span>E-Commerce Recommendation</span></a><ul><li class="level-3"><a 
class="final" href="/templates/ecommercerecommendation/quickstart/"><span>Quick 
Start</span></a></li><li class="level-3"><a class="final" 
href="/templates/ecommercerecommendation/dase/"><span>DASE</span></a></li><li 
class="level-3"><a class="final" 
href="/templates/ecommercerecommendation/how-to/"><span>How-To</span></a></li><li
 class="level-3"><a class="final" 
href="/templates/ecommercerecommendation/train-with-rate-event/"><span>Train 
with Rate Event</span></a></li><li class="level-3"><a class="final" 
href="/templates/ecommercerecommendation/adjust-score/"><span>Adjust 
Score</span></a></li></ul></li><li class="level-2"><a class="expandible" 
href="#"><span>Similar Product</span></a><ul><li class="level-3"><a 
class="final"
  href="/templates/similarproduct/quickstart/"><span>Quick 
Start</span></a></li><li class="level-3"><a class="final" 
href="/templates/similarproduct/dase/"><span>DASE</span></a></li><li 
class="level-3"><a class="final" 
href="/templates/similarproduct/how-to/"><span>How-To</span></a></li><li 
class="level-3"><a class="final" 
href="/templates/similarproduct/multi-events-multi-algos/"><span>Multiple 
Events and Multiple Algorithms</span></a></li><li class="level-3"><a 
class="final" 
href="/templates/similarproduct/return-item-properties/"><span>Returns Item 
Properties</span></a></li><li class="level-3"><a class="final" 
href="/templates/similarproduct/train-with-rate-event/"><span>Train with Rate 
Event</span></a></li><li class="level-3"><a class="final" 
href="/templates/similarproduct/rid-user-set-event/"><span>Get Rid of Events 
for Users</span></a></li><li class="level-3"><a class="final" 
href="/templates/similarproduct/recommended-user/"><span>Recommend 
Users</span></a></li></ul></li><li 
 class="level-2"><a class="expandible" 
href="#"><span>Classification</span></a><ul><li class="level-3"><a 
class="final" href="/templates/classification/quickstart/"><span>Quick 
Start</span></a></li><li class="level-3"><a class="final" 
href="/templates/classification/dase/"><span>DASE</span></a></li><li 
class="level-3"><a class="final" 
href="/templates/classification/how-to/"><span>How-To</span></a></li><li 
class="level-3"><a class="final" 
href="/templates/classification/add-algorithm/"><span>Use Alternative 
Algorithm</span></a></li><li class="level-3"><a class="final" 
href="/templates/classification/reading-custom-properties/"><span>Read Custom 
Properties</span></a></li></ul></li></ul></li><li class="level-1"><a 
class="expandible" href="#"><span>Engine Template Gallery</span></a><ul><li 
class="level-2"><a class="final" 
href="/gallery/template-gallery/"><span>Browse</span></a></li><li 
class="level-2"><a class="final" 
href="/community/submit-template/"><span>Submit your Engine as a Tem
 plate</span></a></li></ul></li><li class="level-1"><a class="expandible" 
href="#"><span>Demo Tutorials</span></a><ul><li class="level-2"><a 
class="final" href="/demo/tapster/"><span>Comics Recommendation 
Demo</span></a></li><li class="level-2"><a class="final" 
href="/demo/community/"><span>Community Contributed Demo</span></a></li><li 
class="level-2"><a class="final" href="/demo/textclassification/"><span>Text 
Classification Engine Tutorial</span></a></li></ul></li><li class="level-1"><a 
class="expandible" href="/community/"><span>Getting Involved</span></a><ul><li 
class="level-2"><a class="final" 
href="/community/contribute-code/"><span>Contribute Code</span></a></li><li 
class="level-2"><a class="final" 
href="/community/contribute-documentation/"><span>Contribute 
Documentation</span></a></li><li class="level-2"><a class="final" 
href="/community/contribute-sdk/"><span>Contribute a SDK</span></a></li><li 
class="level-2"><a class="final" href="/community/contribute-webhook/"><span>Con
 tribute a Webhook</span></a></li><li class="level-2"><a class="final" 
href="/community/projects/"><span>Community 
Projects</span></a></li></ul></li><li class="level-1"><a class="expandible" 
href="#"><span>Getting Help</span></a><ul><li class="level-2"><a class="final" 
href="/resources/faq/"><span>FAQs</span></a></li><li class="level-2"><a 
class="final" href="/support/"><span>Support</span></a></li></ul></li><li 
class="level-1"><a class="expandible" 
href="#"><span>Resources</span></a><ul><li class="level-2"><a class="final" 
href="/cli/"><span>Command-line Interface</span></a></li><li class="level-2"><a 
class="final" href="/resources/release/"><span>Release 
Cadence</span></a></li><li class="level-2"><a class="final" 
href="/resources/intellij/"><span>Developing Engines with IntelliJ 
IDEA</span></a></li><li class="level-2"><a class="final" 
href="/resources/upgrade/"><span>Upgrade Instructions</span></a></li><li 
class="level-2"><a class="final" href="/resources/glossary/"><span>Glossary<
 /span></a></li></ul></li><li class="level-1"><a class="expandible" 
href="#"><span>Apache Software Foundation</span></a><ul><li class="level-2"><a 
class="final" href="https://www.apache.org/";><span>Apache 
Homepage</span></a></li><li class="level-2"><a class="final" 
href="https://www.apache.org/licenses/";><span>License</span></a></li><li 
class="level-2"><a class="final" 
href="https://www.apache.org/foundation/sponsorship.html";><span>Sponsorship</span></a></li><li
 class="level-2"><a class="final" 
href="https://www.apache.org/foundation/thanks.html";><span>Thanks</span></a></li><li
 class="level-2"><a class="final" 
href="https://www.apache.org/security/";><span>Security</span></a></li></ul></li></ul></nav></div><div
 class="col-md-9 col-sm-12"><div class="content-header hidden-md 
hidden-lg"><div id="breadcrumbs" class="hidden-sm hidden xs"><ul><li><a 
href="#">Collecting and Analyzing Data</a><span 
class="spacer">&gt;</span></li><li><span class="last">Collecting Data with 
REST/SDKs</span></l
 i></ul></div><div id="page-title"><h1>Collecting Data through 
REST/SDKs</h1></div></div><div id="table-of-content-wrapper"><h5>On this 
page</h5><aside id="table-of-contents"><ul> <li> <a 
href="#launching-the-event-server">Launching the Event Server</a> </li> <li> <a 
href="#using-event-api">Using Event API</a> </li> <li> <a 
href="#note-about-properties">Note About Properties</a> </li> <li> <a 
href="#debugging-recipes">Debugging Recipes</a> </li> </ul> </aside><hr/><a 
id="edit-page-link" 
href="https://github.com/apache/incubator-predictionio/tree/livedoc/docs/manual/source/datacollection/eventapi.html.md";><img
 src="/images/icons/edit-pencil-d6c1bb3d.png"/>Edit this page</a></div><div 
class="content-header hidden-sm hidden-xs"><div id="breadcrumbs" 
class="hidden-sm hidden xs"><ul><li><a href="#">Collecting and Analyzing 
Data</a><span class="spacer">&gt;</span></li><li><span class="last">Collecting 
Data with REST/SDKs</span></li></ul></div><div id="page-title"><h1>Collecting 
Data throug
 h REST/SDKs</h1></div></div><div class="content"> <p><strong>Event 
Server</strong> is designed to collect data into Apache PredictionIO 
(incubating) in an event-based style. Once the Event Server is launched, your 
application can send data to it through its <strong>Event API</strong> with 
HTTP requests or with <code>EventClient</code>s of PredictionIO&#39;s 
SDKs.</p><div class="alert-message info"><p>All Apache PredictionIO 
(incubating)-compliant engines support accessing the Event Store (i.e. the data 
store of Event Server) through <a 
href="http://predictionio.incubator.apache.org/api/current/index.html#org.apache.predictionio.data.storage.package";>Apache
 PredictionIO (incubating)&#39;s Storage API</a>.</p></div><h2 
id='launching-the-event-server' class='header-anchors'>Launching the Event 
Server</h2><div class="alert-message info"><p>Before launching the Event 
Server, make sure that your event data store backend is properly configured and 
is running. By default, Apache PredictionI
 O (incubating) uses Apache HBase, and a quick configuration can be found <a 
href="/install/install-sourcecode/#hbase">here</a>. Please allow a minute 
(usually less than 30 seconds) after HBase is started for its initialization to 
complete before starting the Event Server.</p></div><p>Everything about Apache 
PredictionIO (incubating) can be done through the <code>pio</code> command. 
Please add PIO binary command path to to your <code>PATH</code> first. Assuming 
PredictionIO is installed at <code>/home/yourname/PredictionIO/</code>, you can 
run</p><div class="highlight shell"><table style="border-spacing: 
0"><tbody><tr><td class="gutter gl" style="text-align: right"><pre 
class="lineno">1</pre></td><td class="code"><pre><span class="gp">$ 
</span><span class="nv">PATH</span><span class="o">=</span><span 
class="nv">$PATH</span>:/home/yourname/PredictionIO/bin; <span 
class="nb">export </span>PATH
+</pre></td></tr></tbody></table> </div> <p>To start the event server, 
run</p><div class="highlight shell"><table style="border-spacing: 
0"><tbody><tr><td class="gutter gl" style="text-align: right"><pre 
class="lineno">1</pre></td><td class="code"><pre><span class="gp">$ </span>pio 
eventserver
+</pre></td></tr></tbody></table> </div> <div class="alert-message info"><p>By 
default, the Event Server is bound to 0.0.0.0, which serves global traffic. To 
tighten security, you may use <code>pio eventserver --ip 127.0.0.1</code> to 
serve only local traffic.</p></div><h3 id='check-server-status' 
class='header-anchors'>Check Server Status</h3><div class="highlight 
shell"><table style="border-spacing: 0"><tbody><tr><td class="gutter gl" 
style="text-align: right"><pre class="lineno">1</pre></td><td 
class="code"><pre><span class="gp">$ </span>curl -i -X GET http://localhost:7070
+</pre></td></tr></tbody></table> </div> <p>Sample response:</p><div 
class="highlight shell"><table style="border-spacing: 0"><tbody><tr><td 
class="gutter gl" style="text-align: right"><pre class="lineno">1
+2
+3
+4
+5
+6
+7</pre></td><td class="code"><pre>HTTP/1.1 200 OK
+Server: spray-can/1.2.1
+Date: Wed, 10 Sep 2014 22:37:30 GMT
+Content-Type: application/json; <span class="nv">charset</span><span 
class="o">=</span>UTF-8
+Content-Length: 18
+
+<span class="o">{</span><span class="s2">"status"</span>:<span 
class="s2">"alive"</span><span class="o">}</span>
+</pre></td></tr></tbody></table> </div> <h3 
id='generating-app-id-and-access-key' class='header-anchors'>Generating App ID 
and Access Key</h3><p>First, you need to create a new app in the Event Server. 
You will later send data into it.</p><div class="highlight shell"><table 
style="border-spacing: 0"><tbody><tr><td class="gutter gl" style="text-align: 
right"><pre class="lineno">1</pre></td><td class="code"><pre><span class="gp">$ 
</span>pio app new MyTestApp
+</pre></td></tr></tbody></table> </div> <blockquote> <p>You can replace 
<code>MyTestApp</code> with name of your App.</p></blockquote> <p>Take note of 
the <em>Access Key</em> and <em>App ID</em> generated. You need the <em>Access 
Key</em> to use the Event API. You should see something like the following 
output:</p><div class="highlight shell"><table style="border-spacing: 
0"><tbody><tr><td class="gutter gl" style="text-align: right"><pre 
class="lineno">1
+2
+3
+4</pre></td><td class="code"><pre><span class="o">[</span>INFO] <span 
class="o">[</span>App<span class="nv">$]</span> Created new app:
+<span class="o">[</span>INFO] <span class="o">[</span>App<span 
class="nv">$]</span>         Name: MyTestApp
+<span class="o">[</span>INFO] <span class="o">[</span>App<span 
class="nv">$]</span>           ID: 6
+<span class="o">[</span>INFO] <span class="o">[</span>App<span 
class="nv">$]</span>   Access Key: 
WPgcXKd42FPQpZHVbVeMyqF4CQJUnXQmIMTHhX3ZUrSzvy1KXJjdFUrslifa9rnB
+</pre></td></tr></tbody></table> </div> <h3 id='creating-your-first-event' 
class='header-anchors'>Creating Your First Event</h3><p>You may connect to the 
Event Server with HTTP request or by using one of many <strong>Apache 
PredictionIO (incubating) SDKs</strong>.</p><p>For example, the following shows 
how one can create an event involving a single entity. Replace the value of 
<code>accessKey</code> by the <em>Access Key</em> generated for your 
App.</p><div class="tabs"> <ul class="control"> <li data-lang="bash"><a 
href="#tab-c632bd06-23a5-45a1-9628-1a3feb5047d3">Raw HTTP</a></li> <li 
data-lang="php"><a href="#tab-c38bea85-1fa6-4627-b04c-32f69453861c">PHP 
SDK</a></li> <li data-lang="python"><a 
href="#tab-6af28f1f-54de-46a5-bcf2-b4eb2cd09acd">Python SDK</a></li> <li 
data-lang="ruby"><a href="#tab-2a9c6633-7124-4090-b38e-64134103e9e7">Ruby 
SDK</a></li> <li data-lang="java"><a 
href="#tab-a41e6c80-f45f-46f9-ba05-aa63bc55b5a7">Java SDK</a></li> </ul> <div 
data-tab="Raw HTTP" data-lang="b
 ash" id="tab-c632bd06-23a5-45a1-9628-1a3feb5047d3"> <div class="highlight 
shell"> <table style="border-spacing: 0"><tbody><tr> <td class="gutter gl" 
style="text-align: right"><pre class="lineno">1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16</pre></td> <td class="code"><pre><span class="gp">$ </span>curl -i -X POST 
http://localhost:7070/events.json?accessKey<span 
class="o">=</span>WPgcXKd42FPQpZHVbVeMyqF4CQJUnXQmIMTHhX3ZUrSzvy1KXJjdFUrslifa9rnB
 <span class="se">\</span>
+-H <span class="s2">"Content-Type: application/json"</span> <span 
class="se">\</span>
+-d <span class="s1">'{
+  "event" : "my_event",
+  "entityType" : "user",
+  "entityId" : "uid",
+  "properties" : {
+    "prop1" : 1,
+    "prop2" : "value2",
+    "prop3" : [1, 2, 3],
+    "prop4" : true,
+    "prop5" : ["a", "b", "c"],
+    "prop6" : 4.56
+  }
+  "eventTime" : "2004-12-13T21:39:45.618-07:00"
+}'</span>
+</pre></td> </tr></tbody></table> </div> </div> <div data-tab="PHP SDK" 
data-lang="php" id="tab-c38bea85-1fa6-4627-b04c-32f69453861c"> <div 
class="highlight php"> <table style="border-spacing: 0"><tbody><tr> <td 
class="gutter gl" style="text-align: right"><pre class="lineno">1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21</pre></td> <td class="code"><pre><span class="cp">&lt;?php</span>
+  <span class="k">require_once</span><span class="p">(</span><span 
class="s2">"vendor/autoload.php"</span><span class="p">);</span>
+
+  <span class="k">use</span> <span 
class="nx">predictionio\EventClient</span><span class="p">;</span>
+
+  <span class="nv">$accessKey</span> <span class="o">=</span> <span 
class="s1">'YOUR_ACCESS_KEY'</span><span class="p">;</span>
+  <span class="nv">$client</span> <span class="o">=</span> <span 
class="k">new</span> <span class="nx">EventClient</span><span 
class="p">(</span><span class="nv">$accessKey</span><span class="p">);</span>
+  <span class="nv">$response</span> <span class="o">=</span> <span 
class="nv">$client</span><span class="o">-&gt;</span><span 
class="na">createEvent</span><span class="p">(</span><span 
class="k">array</span><span class="p">(</span>
+                        <span class="s1">'event'</span> <span 
class="o">=&gt;</span> <span class="s1">'my_event'</span><span 
class="p">,</span>
+                        <span class="s1">'entityType'</span> <span 
class="o">=&gt;</span> <span class="s1">'user'</span><span class="p">,</span>
+                        <span class="s1">'entityId'</span> <span 
class="o">=&gt;</span> <span class="s1">'uid'</span><span class="p">,</span>
+                        <span class="s1">'properties'</span> <span 
class="o">=&gt;</span> <span class="k">array</span><span 
class="p">(</span><span class="s1">'prop1'</span> <span class="o">=&gt;</span> 
<span class="mi">1</span><span class="p">,</span>
+                                              <span class="s1">'prop2'</span> 
<span class="o">=&gt;</span> <span class="s1">'value2'</span><span 
class="p">,</span>
+                                              <span class="s1">'prop3'</span> 
<span class="o">=&gt;</span> <span class="k">array</span><span 
class="p">(</span><span class="mi">1</span><span class="p">,</span><span 
class="mi">2</span><span class="p">,</span><span class="mi">3</span><span 
class="p">),</span>
+                                              <span class="s1">'prop4'</span> 
<span class="o">=&gt;</span> <span class="kc">true</span><span 
class="p">,</span>
+                                              <span class="s1">'prop5'</span> 
<span class="o">=&gt;</span> <span class="k">array</span><span 
class="p">(</span><span class="s1">'a'</span><span class="p">,</span><span 
class="s1">'b'</span><span class="p">,</span><span class="s1">'c'</span><span 
class="p">),</span>
+                                              <span class="s1">'prop6'</span> 
<span class="o">=&gt;</span> <span class="mf">4.56</span>
+                                        <span class="p">),</span>
+                        <span class="s1">'eventTime'</span> <span 
class="o">=&gt;</span> <span class="s1">'2004-12-13T21:39:45.618-07:00'</span>
+                       <span class="p">));</span>
+<span class="cp">?&gt;</span>
+</pre></td> </tr></tbody></table> </div> </div> <div data-tab="Python SDK" 
data-lang="python" id="tab-6af28f1f-54de-46a5-bcf2-b4eb2cd09acd"> <div 
class="highlight python"> <table style="border-spacing: 0"><tbody><tr> <td 
class="gutter gl" style="text-align: right"><pre class="lineno">1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22</pre></td> <td class="code"><pre><span class="kn">from</span> <span 
class="nn">predictionio</span> <span class="kn">import</span> <span 
class="n">EventClient</span>
+<span class="kn">from</span> <span class="nn">datetime</span> <span 
class="kn">import</span> <span class="n">datetime</span>
+<span class="kn">import</span> <span class="nn">pytz</span>
+<span class="n">client</span> <span class="o">=</span> <span 
class="n">EventClient</span><span class="p">(</span><span 
class="s">'YOUR_ACCESS_KEY'</span><span class="p">,</span> <span 
class="s">"http://localhost:7070";</span><span class="p">)</span>
+
+<span class="n">first_event_properties</span> <span class="o">=</span> <span 
class="p">{</span>
+    <span class="s">"prop1"</span> <span class="p">:</span> <span 
class="mi">1</span><span class="p">,</span>
+    <span class="s">"prop2"</span> <span class="p">:</span> <span 
class="s">"value2"</span><span class="p">,</span>
+    <span class="s">"prop3"</span> <span class="p">:</span> <span 
class="p">[</span><span class="mi">1</span><span class="p">,</span> <span 
class="mi">2</span><span class="p">,</span> <span class="mi">3</span><span 
class="p">],</span>
+    <span class="s">"prop4"</span> <span class="p">:</span> <span 
class="bp">True</span><span class="p">,</span>
+    <span class="s">"prop5"</span> <span class="p">:</span> <span 
class="p">[</span><span class="s">"a"</span><span class="p">,</span> <span 
class="s">"b"</span><span class="p">,</span> <span class="s">"c"</span><span 
class="p">],</span>
+    <span class="s">"prop6"</span> <span class="p">:</span> <span 
class="mf">4.56</span> <span class="p">,</span>
+    <span class="p">}</span>
+<span class="n">first_event_time</span> <span class="o">=</span> <span 
class="n">datetime</span><span class="p">(</span>
+  <span class="mi">2004</span><span class="p">,</span> <span 
class="mi">12</span><span class="p">,</span> <span class="mi">13</span><span 
class="p">,</span> <span class="mi">21</span><span class="p">,</span> <span 
class="mi">39</span><span class="p">,</span> <span class="mi">45</span><span 
class="p">,</span> <span class="mi">618000</span><span class="p">,</span> <span 
class="n">pytz</span><span class="o">.</span><span 
class="n">timezone</span><span class="p">(</span><span 
class="s">'US/Mountain'</span><span class="p">))</span>
+<span class="n">first_event_response</span> <span class="o">=</span> <span 
class="n">client</span><span class="o">.</span><span 
class="n">create_event</span><span class="p">(</span>
+    <span class="n">event</span><span class="o">=</span><span 
class="s">"my_event"</span><span class="p">,</span>
+    <span class="n">entity_type</span><span class="o">=</span><span 
class="s">"user"</span><span class="p">,</span>
+    <span class="n">entity_id</span><span class="o">=</span><span 
class="s">"uid"</span><span class="p">,</span>
+    <span class="n">properties</span><span class="o">=</span><span 
class="n">first_event_properties</span><span class="p">,</span>
+    <span class="n">event_time</span><span class="o">=</span><span 
class="n">first_event_time</span><span class="p">,</span>
+<span class="p">)</span>
+</pre></td> </tr></tbody></table> </div> </div> <div data-tab="Ruby SDK" 
data-lang="ruby" id="tab-2a9c6633-7124-4090-b38e-64134103e9e7"> <div 
class="highlight ruby"> <table style="border-spacing: 0"><tbody><tr> <td 
class="gutter gl" style="text-align: right"><pre class="lineno">1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11</pre></td> <td class="code"><pre><span class="nb">require</span> <span 
class="s1">'predictionio'</span>
+
+<span class="n">event_client</span> <span class="o">=</span> <span 
class="no">PredictionIO</span><span class="o">::</span><span 
class="no">EventClient</span><span class="p">.</span><span 
class="nf">new</span><span class="p">(</span><span 
class="s1">'YOUR_ACCESS_KEY'</span><span class="p">)</span>
+<span class="n">event_client</span><span class="p">.</span><span 
class="nf">create_event</span><span class="p">(</span><span 
class="s1">'my_event'</span><span class="p">,</span> <span 
class="s1">'user'</span><span class="p">,</span> <span 
class="s1">'uid'</span><span class="p">,</span>
+                          <span class="s1">'eventTime'</span> <span 
class="o">=&gt;</span> <span 
class="s1">'2004-12-13T21:39:45.618-07:00'</span><span class="p">,</span>
+                          <span class="s1">'properties'</span> <span 
class="o">=&gt;</span> <span class="p">{</span> <span class="s1">'prop1'</span> 
<span class="o">=&gt;</span> <span class="mi">1</span><span class="p">,</span>
+                                            <span class="s1">'prop2'</span> 
<span class="o">=&gt;</span> <span class="s1">'value2'</span><span 
class="p">,</span>
+                                            <span class="s1">'prop3'</span> 
<span class="o">=&gt;</span> <span class="p">[</span><span 
class="mi">1</span><span class="p">,</span> <span class="mi">2</span><span 
class="p">,</span> <span class="mi">3</span><span class="p">],</span>
+                                            <span class="s1">'prop4'</span> 
<span class="o">=&gt;</span> <span class="kp">true</span><span 
class="p">,</span>
+                                            <span class="s1">'prop5'</span> 
<span class="o">=&gt;</span> <span class="sx">%w(a b c)</span><span 
class="p">,</span>
+                                            <span class="s1">'prop6'</span> 
<span class="o">=&gt;</span> <span class="mi">4</span><span 
class="o">.</span><span class="mi">56</span> <span class="p">})</span>
+</pre></td> </tr></tbody></table> </div> </div> <div data-tab="Java SDK" 
data-lang="java" id="tab-a41e6c80-f45f-46f9-ba05-aa63bc55b5a7"> <div 
class="highlight java"> <table style="border-spacing: 0"><tbody><tr> <td 
class="gutter gl" style="text-align: right"><pre class="lineno">1</pre></td> 
<td class="code"><pre><span class="o">(</span><span class="n">coming</span> 
<span class="n">soon</span><span class="o">)</span>
+</pre></td> </tr></tbody></table> </div> </div> </div> <p>For example, the 
following shows how one can create an event involving two entities (with 
<code>targetEntity</code>).</p><div class="tabs"> <ul class="control"> <li 
data-lang="bash"><a href="#tab-a9d97152-3bac-4a15-8fe5-d25d311e631a">Raw 
HTTP</a></li> <li data-lang="php"><a 
href="#tab-77599aa0-b5b5-48a7-b905-3afc703a2466">PHP SDK</a></li> <li 
data-lang="python"><a href="#tab-50bc8238-ae8d-4ac6-b46f-1dd74920ef78">Python 
SDK</a></li> <li data-lang="ruby"><a 
href="#tab-49e03514-7516-47cd-b2d4-02bbecb1fa85">Ruby SDK</a></li> <li 
data-lang="java"><a href="#tab-235a7e50-8e23-4cd0-87c2-dc645383f22a">Java 
SDK</a></li> </ul> <div data-tab="Raw HTTP" data-lang="bash" 
id="tab-a9d97152-3bac-4a15-8fe5-d25d311e631a"> <div class="highlight shell"> 
<table style="border-spacing: 0"><tbody><tr> <td class="gutter gl" 
style="text-align: right"><pre class="lineno">1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14</pre></td> <td class="code"><pre><span class="gp">$ </span>curl -i -X POST 
http://localhost:7070/events.json?accessKey<span 
class="o">=</span>WPgcXKd42FPQpZHVbVeMyqF4CQJUnXQmIMTHhX3ZUrSzvy1KXJjdFUrslifa9rnB
 <span class="se">\</span>
+-H <span class="s2">"Content-Type: application/json"</span> <span 
class="se">\</span>
+-d <span class="s1">'{
+  "event" : "my_event",
+  "entityType" : "user",
+  "entityId" : "uid",
+  "targetEntityType" : "item",
+  "targetEntityId" : "iid",
+  "properties" : {
+    "someProperty" : "value1",
+    "anotherProperty" : "value2"
+  },
+  "eventTime" : "2004-12-13T21:39:45.618Z"
+}'</span>
+</pre></td> </tr></tbody></table> </div> </div> <div data-tab="PHP SDK" 
data-lang="php" id="tab-77599aa0-b5b5-48a7-b905-3afc703a2466"> <div 
class="highlight php"> <table style="border-spacing: 0"><tbody><tr> <td 
class="gutter gl" style="text-align: right"><pre class="lineno">1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18</pre></td> <td class="code"><pre><span class="cp">&lt;?php</span>
+  <span class="k">require_once</span><span class="p">(</span><span 
class="s2">"vendor/autoload.php"</span><span class="p">);</span>
+
+  <span class="k">use</span> <span 
class="nx">predictionio\EventClient</span><span class="p">;</span>
+
+  <span class="nv">$accessKey</span> <span class="o">=</span> <span 
class="s1">'YOUR_ACCESS_KEY'</span><span class="p">;</span>
+  <span class="nv">$client</span> <span class="o">=</span> <span 
class="k">new</span> <span class="nx">EventClient</span><span 
class="p">(</span><span class="nv">$accessKey</span><span class="p">);</span>
+  <span class="nv">$response</span> <span class="o">=</span> <span 
class="nv">$client</span><span class="o">-&gt;</span><span 
class="na">createEvent</span><span class="p">(</span><span 
class="k">array</span><span class="p">(</span>
+                        <span class="s1">'event'</span> <span 
class="o">=&gt;</span> <span class="s1">'my_event'</span><span 
class="p">,</span>
+                        <span class="s1">'entityType'</span> <span 
class="o">=&gt;</span> <span class="s1">'user'</span><span class="p">,</span>
+                        <span class="s1">'entityId'</span> <span 
class="o">=&gt;</span> <span class="s1">'uid'</span><span class="p">,</span>
+                        <span class="s1">'targetEntityType'</span> <span 
class="o">=&gt;</span> <span class="s1">'item'</span><span class="p">,</span>
+                        <span class="s1">'targetEntityId'</span> <span 
class="o">=&gt;</span> <span class="s1">'iid'</span><span class="p">,</span>
+                        <span class="s1">'properties'</span> <span 
class="o">=&gt;</span> <span class="k">array</span><span 
class="p">(</span><span class="s1">'someProperty'</span><span 
class="o">=&gt;</span><span class="s1">'value1'</span><span class="p">,</span>
+                                              <span 
class="s1">'anotherProperty'</span><span class="o">=&gt;</span><span 
class="s1">'value2'</span><span class="p">),</span>
+                        <span class="s1">'eventTime'</span> <span 
class="o">=&gt;</span> <span class="s1">'2004-12-13T21:39:45.618Z'</span>
+                       <span class="p">));</span>
+<span class="cp">?&gt;</span>
+</pre></td> </tr></tbody></table> </div> </div> <div data-tab="Python SDK" 
data-lang="python" id="tab-50bc8238-ae8d-4ac6-b46f-1dd74920ef78"> <div 
class="highlight python"> <table style="border-spacing: 0"><tbody><tr> <td 
class="gutter gl" style="text-align: right"><pre class="lineno">1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13</pre></td> <td class="code"><pre><span class="c"># Second Event</span>
+<span class="n">second_event_properties</span> <span class="o">=</span> <span 
class="p">{</span>
+    <span class="s">"someProperty"</span> <span class="p">:</span> <span 
class="s">"value1"</span><span class="p">,</span>
+    <span class="s">"anotherProperty"</span> <span class="p">:</span> <span 
class="s">"value2"</span><span class="p">,</span>
+    <span class="p">}</span>
+<span class="n">second_event_response</span> <span class="o">=</span> <span 
class="n">client</span><span class="o">.</span><span 
class="n">create_event</span><span class="p">(</span>
+    <span class="n">event</span><span class="o">=</span><span 
class="s">"my_event"</span><span class="p">,</span>
+    <span class="n">entity_type</span><span class="o">=</span><span 
class="s">"user"</span><span class="p">,</span>
+    <span class="n">entity_id</span><span class="o">=</span><span 
class="s">"uid"</span><span class="p">,</span>
+    <span class="n">target_entity_type</span><span class="o">=</span><span 
class="s">"item"</span><span class="p">,</span>
+    <span class="n">target_entity_id</span><span class="o">=</span><span 
class="s">"iid"</span><span class="p">,</span>
+    <span class="n">properties</span><span class="o">=</span><span 
class="n">second_event_properties</span><span class="p">,</span>
+    <span class="n">event_time</span><span class="o">=</span><span 
class="n">datetime</span><span class="p">(</span><span 
class="mi">2014</span><span class="p">,</span> <span class="mi">12</span><span 
class="p">,</span> <span class="mi">13</span><span class="p">,</span> <span 
class="mi">21</span><span class="p">,</span> <span class="mi">38</span><span 
class="p">,</span> <span class="mi">45</span><span class="p">,</span> <span 
class="mi">618000</span><span class="p">,</span> <span 
class="n">pytz</span><span class="o">.</span><span class="n">utc</span><span 
class="p">))</span>
+</pre></td> </tr></tbody></table> </div> </div> <div data-tab="Ruby SDK" 
data-lang="ruby" id="tab-49e03514-7516-47cd-b2d4-02bbecb1fa85"> <div 
class="highlight ruby"> <table style="border-spacing: 0"><tbody><tr> <td 
class="gutter gl" style="text-align: right"><pre class="lineno">1
+2
+3
+4
+5
+6
+7
+8
+9</pre></td> <td class="code"><pre><span class="nb">require</span> <span 
class="s1">'predictionio'</span>
+
+<span class="n">event_client</span> <span class="o">=</span> <span 
class="no">PredictionIO</span><span class="o">::</span><span 
class="no">EventClient</span><span class="p">.</span><span 
class="nf">new</span><span class="p">(</span><span 
class="s1">'YOUR_ACCESS_KEY'</span><span class="p">)</span>
+<span class="n">event_client</span><span class="p">.</span><span 
class="nf">create_event</span><span class="p">(</span><span 
class="s1">'my_event'</span><span class="p">,</span> <span 
class="s1">'user'</span><span class="p">,</span> <span 
class="s1">'uid'</span><span class="p">,</span>
+                          <span class="s1">'targetEntityType'</span> <span 
class="o">=&gt;</span> <span class="s1">'item'</span><span class="p">,</span>
+                          <span class="s1">'targetEntityId'</span> <span 
class="o">=&gt;</span> <span class="s1">'iid'</span><span class="p">,</span>
+                          <span class="s1">'eventTime'</span> <span 
class="o">=&gt;</span> <span class="s1">'2004-12-13T21:39:45.618Z'</span><span 
class="p">,</span>
+                          <span class="s1">'properties'</span> <span 
class="o">=&gt;</span> <span class="p">{</span> <span 
class="s1">'someProperty'</span> <span class="o">=&gt;</span> <span 
class="s1">'value1'</span><span class="p">,</span>
+                                            <span 
class="s1">'anotherProperty'</span> <span class="o">=&gt;</span> <span 
class="s1">'value2'</span> <span class="p">})</span>
+</pre></td> </tr></tbody></table> </div> </div> <div data-tab="Java SDK" 
data-lang="java" id="tab-235a7e50-8e23-4cd0-87c2-dc645383f22a"> <div 
class="highlight java"> <table style="border-spacing: 0"><tbody><tr> <td 
class="gutter gl" style="text-align: right"><pre class="lineno">1</pre></td> 
<td class="code"><pre><span class="o">(</span><span class="n">coming</span> 
<span class="n">soon</span><span class="o">)</span>
+</pre></td> </tr></tbody></table> </div> </div> </div> <p>Sample 
response:</p><div class="highlight shell"><table style="border-spacing: 
0"><tbody><tr><td class="gutter gl" style="text-align: right"><pre 
class="lineno">1
+2
+3
+4
+5
+6
+7</pre></td><td class="code"><pre>HTTP/1.1 201 Created
+Server: spray-can/1.2.1
+Date: Wed, 10 Sep 2014 22:51:33 GMT
+Content-Type: application/json; <span class="nv">charset</span><span 
class="o">=</span>UTF-8
+Content-Length: 41
+
+<span class="o">{</span><span class="s2">"eventId"</span>:<span 
class="s2">"AAAABAAAAQDP3-jSlTMGVu0waj8"</span><span class="o">}</span>
+</pre></td></tr></tbody></table> </div> <h2 id='using-event-api' 
class='header-anchors'>Using Event API</h2><h3 id='event-creation-api' 
class='header-anchors'>Event Creation API</h3><p>URL: 
<code>http://localhost:7070/events.json?accessKey=yourAccessKeyString</code></p><p>Query
 parameters:</p> <table><thead> <tr> <th style="text-align: left">Field</th> 
<th style="text-align: left">Type</th> <th style="text-align: 
left">Description</th> </tr> </thead><tbody> <tr> <td style="text-align: 
left"><code>accessKey</code></td> <td style="text-align: left">String</td> <td 
style="text-align: left">The Access Key for your App</td> </tr> 
</tbody></table> <p>The event creation support many commonly used data. POST 
request body:</p> <table><thead> <tr> <th style="text-align: left">Field</th> 
<th style="text-align: left">Type</th> <th style="text-align: 
left">Description</th> </tr> </thead><tbody> <tr> <td style="text-align: 
left"><code>event</code></td> <td style="text-align: left">String</td> <td
  style="text-align: left">Name of the event.</td> </tr> <tr> <td 
style="text-align: left"></td> <td style="text-align: left"></td> <td 
style="text-align: left">(Examples: &quot;sign-up&quot;, &quot;rate&quot;, 
&quot;view&quot;, &quot;buy&quot;).</td> </tr> <tr> <td style="text-align: 
left"></td> <td style="text-align: left"></td> <td style="text-align: 
left"><strong>Note</strong>: All event names start with &quot;$&quot; and 
&quot;pio_&quot; are reserved</td> </tr> <tr> <td style="text-align: 
left"></td> <td style="text-align: left"></td> <td style="text-align: left">and 
shouldn&#39;t be used as your custom event name (eg. &quot;$set&quot;).</td> 
</tr> <tr> <td style="text-align: left"><code>entityType</code></td> <td 
style="text-align: left">String</td> <td style="text-align: left">The entity 
type. It is the namespace of the entityId and</td> </tr> <tr> <td 
style="text-align: left"></td> <td style="text-align: left"></td> <td 
style="text-align: left">analogous to the table name of 
 a relational database. The</td> </tr> <tr> <td style="text-align: left"></td> 
<td style="text-align: left"></td> <td style="text-align: left">entityId must 
be unique within same entityType.</td> </tr> <tr> <td style="text-align: 
left"></td> <td style="text-align: left"></td> <td style="text-align: 
left"><strong>Note</strong>: All entityType names start with &quot;$&quot; and 
&quot;pio_&quot; are</td> </tr> <tr> <td style="text-align: left"></td> <td 
style="text-align: left"></td> <td style="text-align: left">reserved and 
shouldn&#39;t be used.</td> </tr> <tr> <td style="text-align: 
left"><code>entityId</code></td> <td style="text-align: left">String</td> <td 
style="text-align: left">The entity ID. <code>entityType-entityId</code> 
becomes the unique</td> </tr> <tr> <td style="text-align: left"></td> <td 
style="text-align: left"></td> <td style="text-align: left">identifier of the 
entity. For example, you may have entityType</td> </tr> <tr> <td 
style="text-align: left"></td> <td style
 ="text-align: left"></td> <td style="text-align: left">named 
<code>user</code>, and different entity IDs, say <code>1</code> and 
<code>2</code>. In this</td> </tr> <tr> <td style="text-align: left"></td> <td 
style="text-align: left"></td> <td style="text-align: left">case, 
<code>user-1</code> and <code>user-2</code> uniquely identifies</td> </tr> <tr> 
<td style="text-align: left"></td> <td style="text-align: left"></td> <td 
style="text-align: left">entities.</td> </tr> <tr> <td style="text-align: 
left"><code>targetEntityType</code></td> <td style="text-align: 
left">String</td> <td style="text-align: left">(Optional) The target entity 
type.</td> </tr> <tr> <td style="text-align: left"></td> <td style="text-align: 
left"></td> <td style="text-align: left"><strong>Note</strong>: All entityType 
names start with &quot;$&quot; and &quot;pio_&quot;</td> </tr> <tr> <td 
style="text-align: left"></td> <td style="text-align: left"></td> <td 
style="text-align: left">are reserved and shouldn&#39;
 t be used.</td> </tr> <tr> <td style="text-align: 
left"><code>targetEntityId</code></td> <td style="text-align: left">String</td> 
<td style="text-align: left">(Optional) The target entity ID.</td> </tr> <tr> 
<td style="text-align: left"><code>properties</code></td> <td 
style="text-align: left">JSON</td> <td style="text-align: left">(Optional) See 
<strong>Note About Properties</strong> below</td> </tr> <tr> <td 
style="text-align: left"></td> <td style="text-align: left"></td> <td 
style="text-align: left"><strong>Note</strong>: All peroperty names start with 
&quot;$&quot; and &quot;pio_&quot;</td> </tr> <tr> <td style="text-align: 
left"></td> <td style="text-align: left"></td> <td style="text-align: left">are 
reserved and shouldn&#39;t be used as keys inside <code>properties</code>.</td> 
</tr> <tr> <td style="text-align: left"><code>eventTime</code></td> <td 
style="text-align: left">String</td> <td style="text-align: left">(Optional) 
The time of the event. Although Event Server&#39;s<
 /td> </tr> <tr> <td style="text-align: left"></td> <td style="text-align: 
left"></td> <td style="text-align: left">current system time and UTC timezone 
will be used if this is</td> </tr> <tr> <td style="text-align: left"></td> <td 
style="text-align: left"></td> <td style="text-align: left">unspecified, it is 
highly recommended that this time should be</td> </tr> <tr> <td 
style="text-align: left"></td> <td style="text-align: left"></td> <td 
style="text-align: left">generated by the client application in order to 
accurately</td> </tr> <tr> <td style="text-align: left"></td> <td 
style="text-align: left"></td> <td style="text-align: left">record the time of 
the event.</td> </tr> <tr> <td style="text-align: left"></td> <td 
style="text-align: left"></td> <td style="text-align: left">Must be in ISO 8601 
format (e.g.</td> </tr> <tr> <td style="text-align: left"></td> <td 
style="text-align: left"></td> <td style="text-align: 
left"><code>2004-12-13T21:39:45.618Z</code>, or <code>2014-09-09T16
 :17:42.937-08:00</code>).</td> </tr> </tbody></table> <h2 
id='note-about-properties' class='header-anchors'>Note About 
Properties</h2><p>Note that <code>properties</code> can be:</p> <ol> 
<li>Associated with an <em>generic event</em>: The <code>properties</code> 
field provide additional information about this event</li> <li>Associated with 
an <em>entity</em>: The <code>properties</code> field is used to record the 
changes of an entity&#39;s properties with special events <code>$set</code>, 
<code>$unset</code> and <code>$delete</code>.</li> </ol> <p>Please see the <a 
href="/datacollection/eventmodel/">Events Modeling</a> for detailed 
explanation.</p><h2 id='debugging-recipes' class='header-anchors'>Debugging 
Recipes</h2><div class="alert-message warning"><p>The following API are mainly 
for development or debugging purpose only. They should not be supported by SDK 
nor used by real application under normal circumstances and they are subject to 
changes.</p></div><div class="alert-messag
 e info"><p>Instead of using <code>curl</code>, you can also install JSON 
browser plugins such as <strong>JSONView</strong> to pretty-print the JSON on 
your browser. With the browser plugin you can make the <code>GET</code> queries 
below by passing in the URL. Plugins like <strong>Postman - REST 
Client</strong> provide a more advanced interface for making 
queries.</p></div><p>The <code>accessKey</code> query parameter is 
mandatory.</p><p>Replace <code>&lt;your_accessKey&gt;</code> and 
<code>&lt;your_eventId&gt;</code> by a real one in the following:</p><h3 
id='get-an-event' class='header-anchors'>Get an Event</h3><div class="highlight 
shell"><table style="border-spacing: 0"><tbody><tr><td class="gutter gl" 
style="text-align: right"><pre class="lineno">1</pre></td><td 
class="code"><pre><span class="gp">$ </span>curl -i -X GET 
http://localhost:7070/events/&lt;your_eventId&gt;.json?accessKey<span 
class="o">=</span>&lt;your_accessKey&gt;
+</pre></td></tr></tbody></table> </div> <h3 id='delete-an-event' 
class='header-anchors'>Delete an Event</h3><div class="highlight shell"><table 
style="border-spacing: 0"><tbody><tr><td class="gutter gl" style="text-align: 
right"><pre class="lineno">1</pre></td><td class="code"><pre><span class="gp">$ 
</span>curl -i -X DELETE 
http://localhost:7070/events/&lt;your_eventId&gt;.json?accessKey<span 
class="o">=</span>&lt;your_accessKey&gt;
+</pre></td></tr></tbody></table> </div> <h3 id='get-events-of-an-app' 
class='header-anchors'>Get Events of an App</h3><div class="highlight 
shell"><table style="border-spacing: 0"><tbody><tr><td class="gutter gl" 
style="text-align: right"><pre class="lineno">1</pre></td><td 
class="code"><pre><span class="gp">$ </span>curl -i -X GET 
http://localhost:7070/events.json?accessKey<span 
class="o">=</span>&lt;your_accessKey&gt;
+</pre></td></tr></tbody></table> </div> <div class="alert-message info"><p>By 
default, it returns at most 20 events. Use the <code>limit</code> parameter to 
specify how many events returned (see below). Use cautiously!</p></div><p>In 
addition, the following <em>optional</em> parameters are supported:</p> <ul> 
<li><code>startTime</code>: time in ISO8601 format. Return events with 
<code>eventTime &gt;= startTime</code>.</li> <li><code>untilTime</code>: time 
in ISO8601 format. Return events with <code>eventTime &lt; 
untilTime</code>.</li> <li><code>entityType</code>: String. The entityType. 
Return events for this <code>entityType</code> only.</li> 
<li><code>entityId</code>: String. The entityId. Return events for this 
<code>entityId</code> only.</li> <li><code>event</code>: String. The event 
name. Return events with this name only.</li> 
<li><code>targetEntityType</code>: String. The targetEntityType. Return events 
for this <code>targetEntityType</code> only.</li> <li><code>targetEntity
 Id</code>: String. The targetEntityId. Return events for this 
<code>targetEntityId</code> only.</li> <li><code>limit</code>: Integer. The 
number of record events returned. Default is 20. -1 to get all.</li> 
<li><code>reversed</code>: Boolean. <strong>Must be used with both 
<code>entityType</code> and <code>entityId</code> specified</strong>, returns 
events in reversed chronological order. Default is false.</li> </ul> <div 
class="alert-message warning"><p>If you are using <code>curl</code> with the 
<code>&amp;</code> symbol, you should quote the entire URL by using single or 
double quotes.</p></div><div class="alert-message warning"><p>Depending on the 
size of data, you may encounter timeout when querying with some of the above 
filters. Event server uses <code>entityType</code> and <code>entityId</code> as 
the key so any query without both <code>entityType</code> and 
<code>entityId</code> specified might result in a timeout.</p></div><p>For 
example, get all events of an app with <cod
 e>eventTime &gt;= startTime</code></p><div class="highlight shell"><table 
style="border-spacing: 0"><tbody><tr><td class="gutter gl" style="text-align: 
right"><pre class="lineno">1</pre></td><td class="code"><pre><span class="gp">$ 
</span>curl -i -X GET <span 
class="s2">"http://localhost:7070/events.json?accessKey=&lt;your_accessKey&gt;&amp;startTime=&lt;time
 in ISO8601 format&gt;"</span>
+</pre></td></tr></tbody></table> </div> <p>For example, get all events of an 
app with <code>eventTime &lt; untilTime</code>:</p><div class="highlight 
shell"><table style="border-spacing: 0"><tbody><tr><td class="gutter gl" 
style="text-align: right"><pre class="lineno">1</pre></td><td 
class="code"><pre><span class="gp">$ </span>curl -i -X GET <span 
class="s2">"http://localhost:7070/events.json?accessKey=&lt;your_accessKey&gt;&amp;untilTime=&lt;time
 in ISO8601 format&gt;"</span>
+</pre></td></tr></tbody></table> </div> <p>For example, get all events of an 
app with <code>eventTime &gt;= startTime</code> and <code>eventTime &lt; 
untilTime</code>:</p><div class="highlight shell"><table style="border-spacing: 
0"><tbody><tr><td class="gutter gl" style="text-align: right"><pre 
class="lineno">1</pre></td><td class="code"><pre><span class="gp">$ </span>curl 
-i -X GET <span 
class="s2">"http://localhost:7070/events.json?accessKey=&lt;your_accessKey&gt;&amp;startTime=&lt;time
 in ISO8601 format&gt;&amp;untilTime=&lt;time in ISO8601 format&gt;"</span>
+</pre></td></tr></tbody></table> </div> <p>For example, get all events of a 
specific entity with <code>eventTime &lt; untilTime</code>:</p><div 
class="highlight shell"><table style="border-spacing: 0"><tbody><tr><td 
class="gutter gl" style="text-align: right"><pre class="lineno">1</pre></td><td 
class="code"><pre><span class="gp">$ </span>curl -i -X GET <span 
class="s2">"http://localhost:7070/events.json?accessKey=&lt;your_accessKey&gt;&amp;entityType=&lt;your_entityType&gt;&amp;entityId=&lt;your_entityId&gt;&amp;untilTime=&lt;time
 in ISO801 format&gt;"</span>
+</pre></td></tr></tbody></table> </div> <h3 id='delete-all-events-of-an-app' 
class='header-anchors'>Delete All Events of an App</h3><p>Please use the 
following CLI command:</p><div class="highlight shell"><table 
style="border-spacing: 0"><tbody><tr><td class="gutter gl" style="text-align: 
right"><pre class="lineno">1</pre></td><td class="code"><pre><span class="gp">$ 
</span>pio app data-delete &lt;your_app_name&gt;
+</pre></td></tr></tbody></table> </div> <div class="alert-message info"><p>See 
<a href="/cli/#event-server-commands">here</a> to know details of command-line 
interface for the event server.</p></div></div></div></div></div><footer><div 
class="container"><div class="seperator"></div><div class="row"><div 
class="col-md-6 footer-link-column"><div 
class="footer-link-column-row"><h4>Community</h4><ul><li><a 
href="//predictionio.incubator.apache.org/install/" 
target="blank">Download</a></li><li><a 
href="//predictionio.incubator.apache.org/" target="blank">Docs</a></li><li><a 
href="//github.com/apache/incubator-predictionio" 
target="blank">GitHub</a></li><li><a 
href="mailto:[email protected]"; 
target="blank">Subscribe to User Mailing List</a></li><li><a 
href="//stackoverflow.com/questions/tagged/predictionio" 
target="blank">Stackoverflow</a></li></ul></div></div><div class="col-md-6 
footer-link-column"><div class="footer-link-column-row"><h4>Contribute</h4><ul
 ><li><a href="//predictionio.incubator.apache.org/community/contribute-code/" 
 >target="blank">Contribute</a></li><li><a 
 >href="//github.com/apache/incubator-predictionio" target="blank">Source 
 >Code</a></li><li><a href="//issues.apache.org/jira/browse/PIO" 
 >target="blank">Bug Tracker</a></li><li><a 
 >href="mailto:[email protected]"; 
 >target="blank">Subscribe to Development Mailing 
 >List</a></li></ul></div></div></div><div class="row"><div class="col-md-12 
 >footer-link-column"><p>Apache PredictionIO, PredictionIO, Apache, the Apache 
 >feather logo, and the Apache PredictionIO project logo are either registered 
 >trademarks or trademarks of The Apache Software Foundation in the United 
 >States and other countries.</p><p>All other marks mentioned may be trademarks 
 >or registered trademarks of their respective owners.</p></div></div><div 
 >class="row"><div class="col-md-12 footer-link-column"><a class="pull-right" 
 >href="http://incubator.apache.org/projects/predictionio.html";>
 <img alt="Apache Incubator" 
src="/images/logos/apache_incubator-6954bd16.png"/></a><span>Apache 
PredictionIO is an effort undergoing incubation at The Apache Software 
Foundation (ASF), sponsored by the Apache Incubator. Incubation is required of 
all newly accepted projects until a further review indicates that the 
infrastructure, communications, and decision making process have stabilized in 
a manner consistent with other successful ASF projects. While incubation status 
is not necessarily a reflection of the completeness or stability of the code, 
it does indicate that the project has yet to be fully endorsed by the 
ASF.</span></div></div></div><div id="footer-bottom"><div 
class="container"><div class="row"><div class="col-md-12"><div 
id="footer-logo-wrapper"><img alt="PredictionIO" 
src="/images/logos/logo-white-d1e9c6e6.png"/><span>™</span></div><div 
id="social-icons-wrapper"><a class="github-button" 
href="https://github.com/apache/incubator-predictionio"; data-style="mega" 
data-co
 unt-href="/apache/incubator-predictionio/stargazers" 
data-count-api="/repos/apache/incubator-predictionio#stargazers_count" 
data-count-aria-label="# stargazers on GitHub" aria-label="Star 
apache/incubator-predictionio on GitHub">Star</a> <a class="github-button" 
href="https://github.com/apache/incubator-predictionio/fork"; 
data-icon="octicon-git-branch" data-style="mega" 
data-count-href="/apache/incubator-predictionio/network" 
data-count-api="/repos/apache/incubator-predictionio#forks_count" 
data-count-aria-label="# forks on GitHub" aria-label="Fork 
apache/incubator-predictionio on GitHub">Fork</a> <script id="github-bjs" 
async="" defer="" src="https://buttons.github.io/buttons.js";></script><a 
href="https://twitter.com/predictionio"; target="blank"><img alt="PredictionIO 
on Twitter" src="/images/icons/twitter-ea9dc152.png"/></a> <a 
href="https://www.facebook.com/predictionio"; target="blank"><img 
alt="PredictionIO on Facebook" src="/images/icons/facebook-5c57939c.png"/></a> 
</div></div
 ></div></div></div></footer></div><script>(function(w,d,t,u,n,s,e){w['SwiftypeObject']=n;w[n]=w[n]||function(){
+(w[n].q=w[n].q||[]).push(arguments);};s=d.createElement(t);
+e=d.getElementsByTagName(t)[0];s.async=1;s.src=u;e.parentNode.insertBefore(s,e);
+})(window,document,'script','//s.swiftypecdn.com/install/v1/st.js','_st');
+
+_st('install','HaUfpXXV87xoB_zzCQ45');</script><script 
src="/javascripts/application-a6acb1f5.js"></script></body></html>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-predictionio-site/blob/4e7d331e/datacollection/eventapi/index.html.gz
----------------------------------------------------------------------
diff --git a/datacollection/eventapi/index.html.gz 
b/datacollection/eventapi/index.html.gz
new file mode 100644
index 0000000..0bfbe93
Binary files /dev/null and b/datacollection/eventapi/index.html.gz differ

Reply via email to