http://git-wip-us.apache.org/repos/asf/incubator-predictionio-site/blob/5b520d3f/datacollection/channel/index.html
----------------------------------------------------------------------
diff --git a/datacollection/channel/index.html 
b/datacollection/channel/index.html
new file mode 100644
index 0000000..271c8c8
--- /dev/null
+++ b/datacollection/channel/index.html
@@ -0,0 +1,123 @@
+<!DOCTYPE html><html><head><title>Channel</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="Channel"/><link rel="canonical" 
href="https://docs.prediction.io/datacollection/channel/"/><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-3a3867f7.css" 
rel="stylesheet" type="text/css"/><script 
src="//cdnjs.cloudflare.com/ajax/libs/html5shiv/3.7.2/html5shiv.min.js"></script><script
 src="//cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MM
 L_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></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-pa
 ge-heading-wrapper"><p>PredictionIO Docs</p><h4>Channel</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-fluid"><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="expandible" 
href="#"><span>Integrating with Your App</span></a><ul><li class="level-2"><a 
class="final" href="/appi
 ntegration/"><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="/cli/#engine-commands"><span>Engine Command-line 
Interface</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></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 
Overvie
 w</span></a></li><li class="level-2"><a class="final" 
href="/cli/#event-server-commands"><span>Event Server Command-line 
Interface</span></a></li><li class="level-2"><a class="final" 
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 active" 
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></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="/a
 lgorithm/"><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="/evaluat
 ion/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>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 
Template</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 Contrib
 uted 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>Contribute 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="/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></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">Channel</span></li></ul></div><div 
 >id="page-title"><h1>Channel</h1></div></div><div 
 >id="table-of-content-wrapper"><h5>On this page</h5><aside 
 >id="table-of-contents"><ul> <li> <a href="#create-a-new-channel">Create a ne
 w Channel</a> </li> <li> <a href="#collect-data-through-channel">Collect data 
through Channel</a> </li> <li> <a 
href="#delete-a-channel-including-all-imported-data">Delete a Channel 
(including all imported data)</a> </li> <li> <a 
href="#delete-the-data-only-of-a-channel">Delete the data-only of a Channel</a> 
</li> <li> <a href="#accessing-channel-data-in-engine">Accessing Channel Data 
in Engine</a> </li> </ul> </aside><hr/><a id="edit-page-link" 
href="https://github.com/apache/incubator-predictionio/tree/livedoc/docs/manual/source/datacollection/channel.html.md.erb";><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">Channel</span></li></ul></div><div 
id="page-title"><h1>Channel</h1></div></div><div class="content"><p>Each App 
has a default channel (wit
 hout name) which stores all incoming events. This &quot;default&quot; one is 
used when channel is not specified.</p><p>You may create additional Channels 
for the App. Creating multiple Channels is advanced usage. You don&#39;t need 
to create any in order to use Apache PredictionIO (incubating). The Channel is 
associated with one App only and must have unique name within the same 
App.</p><p>Creating multiple Channels allows you more easily to identify, 
manage and use specific event data if you may collect events from different 
multiple sources (eg. mobile, website, or third-party webhooks service) for the 
your application.</p><p>(More usage details coming soon...)</p><h2 
id='create-a-new-channel' class='header-anchors'>Create a new 
Channel</h2><p>For example, to create a new channel &quot;myChannel&quot; for 
app &quot;myApp&quot;, run following <code>pio</code> 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>pio app 
channel-new myApp myChannel
+</pre></td></tr></tbody></table> </div> <p>you should see something like the 
following outputs:</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><span class="o">[</span>INFO] <span 
class="o">[</span>App<span class="nv">$]</span> Updated Channel meta-data.
+<span class="o">[</span>INFO] <span class="o">[</span>HBLEvents] The table 
predictionio_eventdata:events_5_2 doesn<span class="s1">'t exist yet. Creating 
now...
+[INFO] [App$] Initialized Event Store for the channel: myChannel.
+[INFO] [App$] Created new channel:
+[INFO] [App$]     Channel Name: myChannel
+[INFO] [App$]       Channel ID: 2
+[INFO] [App$]           App ID: 5
+</span></pre></td></tr></tbody></table> </div> <p>Now &quot;myChannel&quot; is 
created and ready for collecting data.</p><h2 id='collect-data-through-channel' 
class='header-anchors'>Collect data through Channel</h2><p>The Event API 
support optional <code>channel</code> query parameter. This allows you to 
import and query events of the specified channel. When the <code>channel</code> 
parameter is not specified, the data is collected through the default 
channel.</p><p>URL: 
<code>http://localhost:7070/events.json?accessKey=yourAccessKeyString&amp;channel=yourChannelName</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> <tr> <td 
style="text-align: left"><code>channel</c
 ode></td> <td style="text-align: left">String</td> <td style="text-align: 
left">The channel name (optional). Specify this to import data to this channel. 
<strong>NOTE: supported in PIO version &gt;= 0.9.2</strong> only. Channel must 
be created first.</td> </tr> </tbody></table> <p>For SDK usage, one EventClient 
should be responsible for collecting data of one specific channel. The channel 
name is specified when the EventClient object is instantiated.</p><p>For 
example, the following code import event to &quot;YOUR_CHANNEL&quot; of the 
corresponding App.</p><div class="tabs"> <ul class="control"> <li 
data-lang="bash"><a href="#tab-02a6eec0-0e7f-41c1-a46a-47e06f3239a8">Raw 
HTTP</a></li> <li data-lang="php"><a 
href="#tab-53c60697-7204-4756-9830-c385266b09c9">PHP SDK</a></li> <li 
data-lang="python"><a href="#tab-84c373ca-1aac-4378-b120-39f91c0ff69c">Python 
SDK</a></li> <li data-lang="ruby"><a 
href="#tab-daa071e0-b2f3-4721-b39d-eba4b628f24b">Ruby SDK</a></li> <li 
data-lang="java"><a href
 ="#tab-d6e4bc80-5304-4622-a1a8-7dbb9cc03512">Java SDK</a></li> </ul> <div 
data-tab="Raw HTTP" data-lang="bash" 
id="tab-02a6eec0-0e7f-41c1-a46a-47e06f3239a8"> <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>YOUR_ACCESS_KEY&amp;channel<span 
class="o">=</span>YOUR_CHANNEL <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-53c60697-7204-4756-9830-c385266b09c9"> (TODO: update 
me) </div> <div data-tab="Python SDK" data-lang="python" 
id="tab-84c373ca-1aac-4378-b120-39f91c0ff69c"> <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</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="c"># Create a EventClient for "YOUR_CHANNEL"</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">channel</span><span class="o">=</span><span 
class="s">'YOUR_CHANNEL'</span><span class="p">)</span> <span class="c"># 
default channel if not specified</span>
+
+<span class="n">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">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">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-daa071e0-b2f3-4721-b39d-eba4b628f24b"> (TODO: update 
me) </div> <div data-tab="Java SDK" data-lang="java" 
id="tab-d6e4bc80-5304-4622-a1a8-7dbb9cc03512"> <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>You can also follow 
the EventAPI <a href="/datacollection/eventapi/#debugging-recipes">debug 
receipts</a> to query the events of specific channel by adding the 
<code>channel</code> query parameter in the URL.</p><h2 
id='delete-a-channel-(including-all-imported-data)' 
class='header-anchors'>Delete a Channel (including all imported data)</h2><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>pio app channel-delete &lt;app name&gt; &lt;channel name&gt;
+</pre></td></tr></tbody></table> </div> <h2 
id='delete-the-data-only-of-a-channel' class='header-anchors'>Delete the 
data-only of a Channel</h2><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>pio app 
data-delete &lt;app name&gt; --channel &lt;channel name&gt;
+</pre></td></tr></tbody></table> </div> <h2 
id='accessing-channel-data-in-engine' class='header-anchors'>Accessing Channel 
Data in Engine</h2><p>To acccess channel data, simply specify the channel name 
when use the PEventStore or LEventStore API. Data is read from from the default 
channel if channelName is not specified.</p><p>For example, read data from 
default channel:</p><div class="highlight scala"><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</pre></td><td class="code"><pre>
+    <span class="k">val</span> <span class="n">eventsRDD</span><span 
class="k">:</span> <span class="kt">RDD</span><span class="o">[</span><span 
class="kt">Event</span><span class="o">]</span> <span class="k">=</span> <span 
class="nc">PEventStore</span><span class="o">.</span><span 
class="n">find</span><span class="o">(</span>
+      <span class="n">appName</span> <span class="k">=</span> <span 
class="n">dsp</span><span class="o">.</span><span class="n">appName</span><span 
class="o">,</span>
+      <span class="n">entityType</span> <span class="k">=</span> <span 
class="nc">Some</span><span class="o">(</span><span 
class="s">"user"</span><span class="o">),</span>
+      <span class="n">eventNames</span> <span class="k">=</span> <span 
class="nc">Some</span><span class="o">(</span><span class="nc">List</span><span 
class="o">(</span><span class="s">"rate"</span><span class="o">,</span> <span 
class="s">"buy"</span><span class="o">)),</span> <span class="c1">// read 
"rate" and "buy" event
+</span>      <span class="c1">// targetEntityType is optional field of an 
event.
+</span>      <span class="n">targetEntityType</span> <span class="k">=</span> 
<span class="nc">Some</span><span class="o">(</span><span 
class="nc">Some</span><span class="o">(</span><span 
class="s">"item"</span><span class="o">)))(</span><span 
class="n">sc</span><span class="o">)</span>
+
+</pre></td></tr></tbody></table> </div> <p>For examlpe, read data from the 
channel &quot;CHANNEL_NAME&quot;</p><div class="highlight scala"><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="k">val</span> <span class="n">eventsRDD</span><span 
class="k">:</span> <span class="kt">RDD</span><span class="o">[</span><span 
class="kt">Event</span><span class="o">]</span> <span class="k">=</span> <span 
class="nc">PEventStore</span><span class="o">.</span><span 
class="n">find</span><span class="o">(</span>
+      <span class="n">appName</span> <span class="k">=</span> <span 
class="n">dsp</span><span class="o">.</span><span class="n">appName</span><span 
class="o">,</span>
+      <span class="n">channelName</span> <span class="k">=</span> <span 
class="nc">Some</span><span class="o">(</span><span 
class="s">"CHANNEL_NAME"</span><span class="o">),</span> <span class="c1">// 
ADDED
+</span>      <span class="n">entityType</span> <span class="k">=</span> <span 
class="nc">Some</span><span class="o">(</span><span 
class="s">"user"</span><span class="o">),</span>
+      <span class="n">eventNames</span> <span class="k">=</span> <span 
class="nc">Some</span><span class="o">(</span><span class="nc">List</span><span 
class="o">(</span><span class="s">"rate"</span><span class="o">,</span> <span 
class="s">"buy"</span><span class="o">)),</span> <span class="c1">// read 
"rate" and "buy" event
+</span>      <span class="c1">// targetEntityType is optional field of an 
event.
+</span>      <span class="n">targetEntityType</span> <span class="k">=</span> 
<span class="nc">Some</span><span class="o">(</span><span 
class="nc">Some</span><span class="o">(</span><span 
class="s">"item"</span><span class="o">)))(</span><span 
class="n">sc</span><span class="o">)</span>
+
+</pre></td></tr></tbody></table> </div> </div></div></div></div><footer><div 
class="container"><div class="seperator"></div><div class="row"><div 
class="col-md-6 col-xs-6 footer-link-column"><div 
class="footer-link-column-row"><h4>Community</h4><ul><li><a 
href="//docs.prediction.io/install/" target="blank">Download</a></li><li><a 
href="//docs.prediction.io/" 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 
col-xs-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" ta
 rget="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><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"/></div><div 
id="social-icons-wrapper"><a class="github-button" 
href="https://github.com/apache/incubator-predictionio"; data-style="mega" 
data-count-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="//www.facebook.com/predictionio" target="blank"><img alt="PredictionIO on 
Twitter" src="/images/icons/twitter-ea9dc152.png"/></a> <a 
href="//twitter.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-f819cf19.js"></script></body></html>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-predictionio-site/blob/5b520d3f/datacollection/channel/index.html.gz
----------------------------------------------------------------------
diff --git a/datacollection/channel/index.html.gz 
b/datacollection/channel/index.html.gz
new file mode 100644
index 0000000..d44d351
Binary files /dev/null and b/datacollection/channel/index.html.gz differ

http://git-wip-us.apache.org/repos/asf/incubator-predictionio-site/blob/5b520d3f/datacollection/eventapi/index.html
----------------------------------------------------------------------
diff --git a/datacollection/eventapi/index.html 
b/datacollection/eventapi/index.html
new file mode 100644
index 0000000..791fa93
--- /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://docs.prediction.io/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-3a3867f7.css" 
rel="stylesheet" type="text/css"/><script 
src="//cdnjs.cloudflare.com/ajax/libs/html5shiv/3.7.2/html5shiv.min.js"></script><script
 src="//cdn.ma
 
thjax.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></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-fluid"><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="expandible" 
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="/cli/#engine-commands"><span>Engine Command-line Interface</spa
 n></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></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" 
href="/cli/#event-server-commands"><span>Event Server Command-line 
Interface</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></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 Evaluatio
 n 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>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 
Template</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 clas
 s="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>Contribute 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="/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></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></li></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 through REST/SDKs</h1></div></div><div class="content"><p><strong>Event 
Server</strong> is designed to colle
 ct 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://docs.prediction.io/api/current/index.html#io.prediction.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 PredictionIO (incubating) uses Apache HBase, and 
a quick configuration can be found <a 
href="/install/install-linux/#hbase">here</a>. Pleas
 e 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-d4cbfd35-0d74-421b-9aac-692b2aaa03a4">Raw HTTP</a></li> <li 
data-lang="php"><a href="#tab-40e5b63d-803b-4491-b3ed-c2cb52b84034">PHP 
SDK</a></li> <li data-lang="python"><a 
href="#tab-d0bd20b8-59db-4400-8521-b1d72b0985e5">Python SDK</a></li> <li 
data-lang="ruby"><a href="#tab-7b3da215-266a-4c1d-b2dd-f82df263751a">Ruby 
SDK</a></li> <li data-lang="java"><a 
href="#tab-6804b730-9315-4ba6-a39a-bd1330778908">Java SDK</a></li> </ul> <div 
data-tab="Raw HTTP" data-lang="b
 ash" id="tab-d4cbfd35-0d74-421b-9aac-692b2aaa03a4"> <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-40e5b63d-803b-4491-b3ed-c2cb52b84034"> <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-d0bd20b8-59db-4400-8521-b1d72b0985e5"> <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-7b3da215-266a-4c1d-b2dd-f82df263751a"> <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-6804b730-9315-4ba6-a39a-bd1330778908"> <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-8f7e3d6b-1a46-46ec-8d43-9a5f87f185ff">Raw 
HTTP</a></li> <li data-lang="php"><a 
href="#tab-32a253e6-ef1c-44df-b1a8-d41b300e2de2">PHP SDK</a></li> <li 
data-lang="python"><a href="#tab-61170244-4fe2-4485-a48f-2f5151e29cb9">Python 
SDK</a></li> <li data-lang="ruby"><a 
href="#tab-3ec8cde9-946c-421c-abbe-98f7fdbb26fa">Ruby SDK</a></li> <li 
data-lang="java"><a href="#tab-8f0f1201-850b-4891-97d6-745c9dfafebe">Java 
SDK</a></li> </ul> <div data-tab="Raw HTTP" data-lang="bash" 
id="tab-8f7e3d6b-1a46-46ec-8d43-9a5f87f185ff"> <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-32a253e6-ef1c-44df-b1a8-d41b300e2de2"> <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-61170244-4fe2-4485-a48f-2f5151e29cb9"> <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-3ec8cde9-946c-421c-abbe-98f7fdbb26fa"> <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-8f0f1201-850b-4891-97d6-745c9dfafebe"> <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></div></div></div><footer><div 
class="container"><div class="seperator"></div><div class="row"><div 
class="col-md-6 col-xs-6 footer-link-column"><div 
class="footer-link-column-row"><h4>Community</h4><ul><li><a 
href="//docs.prediction.io/install/" target="blank">Download</a></li><li><a 
href="//docs.prediction.io/" 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 
col-xs-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" ta
 rget="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><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"/></div><div 
id="social-icons-wrapper"><a class="github-button" 
href="https://github.com/apache/incubator-predictionio"; data-style="mega" 
data-count-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="//www.facebook.com/predictionio" target="blank"><img alt="PredictionIO on 
Twitter" src="/images/icons/twitter-ea9dc152.png"/></a> <a 
href="//twitter.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-f819cf19.js"></script></body></html>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-predictionio-site/blob/5b520d3f/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..e979417
Binary files /dev/null and b/datacollection/eventapi/index.html.gz differ

Reply via email to