http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/4a92ab09/content/docs/counters-and-events/creating-and-incrementing-counters.html ---------------------------------------------------------------------- diff --git a/content/docs/counters-and-events/creating-and-incrementing-counters.html b/content/docs/counters-and-events/creating-and-incrementing-counters.html new file mode 100644 index 0000000..511a0e3 --- /dev/null +++ b/content/docs/counters-and-events/creating-and-incrementing-counters.html @@ -0,0 +1,406 @@ + + +<!DOCTYPE html> +<!--[if IE 8]><html class="no-js lt-ie9" lang="en" > <![endif]--> +<!--[if gt IE 8]><!--> <html class="no-js" lang="en" > <!--<![endif]--> +<head> + <meta charset="utf-8"> + + <meta name="viewport" content="width=device-width, initial-scale=1.0"> + + <title>Creating & incrementing counters — Apache Usergrid 1.0 documentation</title> + + + + + + + + + + + + + + + + <link rel="stylesheet" href="../_static/css/theme.css" type="text/css" /> + + + + + + <link rel="top" title="Apache Usergrid 1.0 documentation" href="../index.html"/> + <link rel="next" title="Retrieving counters" href="retrieving-counters.html"/> + <link rel="prev" title="Counters & events" href="events-and-counters.html"/> + + + <script src="../_static/js/modernizr.min.js"></script> + +</head> + +<body class="wy-body-for-nav" role="document"> + + <div class="wy-grid-for-nav"> + + + <nav data-toggle="wy-nav-shift" class="wy-nav-side"> + <div class="wy-side-nav-search"> + + + + <a href="../index.html" class="icon icon-home"> Apache Usergrid + + + + </a> + + + + + <div class="version"> + 1.0 + </div> + + + + +<div role="search"> + <form id="rtd-search-form" class="wy-form" action="../search.html" method="get"> + <input type="text" name="q" placeholder="Search docs" /> + <input type="hidden" name="check_keywords" value="yes" /> + <input type="hidden" name="area" value="default" /> + </form> +</div> + + + </div> + + <div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation"> + + + + <p class="caption"><span class="caption-text">Introduction</span></p> +<ul> +<li class="toctree-l1"><a class="reference internal" href="../introduction/usergrid-features.html">Usergrid Features</a></li> +<li class="toctree-l1"><a class="reference internal" href="../introduction/data-model.html">Usergrid Data model</a></li> +<li class="toctree-l1"><a class="reference internal" href="../introduction/async-vs-sync.html">Async vs. sync calls</a></li> +</ul> +<p class="caption"><span class="caption-text">Getting Started</span></p> +<ul> +<li class="toctree-l1"><a class="reference internal" href="../getting-started/creating-a-new-application.html">Creating a new application</a></li> +<li class="toctree-l1"><a class="reference internal" href="../getting-started/creating-account.html">Creating an Usergrid Account</a></li> +<li class="toctree-l1"><a class="reference internal" href="../getting-started/using-a-sandbox-app.html">Using a Sandbox Application</a></li> +<li class="toctree-l1"><a class="reference internal" href="../getting-started/using-the-api.html">Using the API</a></li> +</ul> +<p class="caption"><span class="caption-text">Data Storage</span></p> +<ul> +<li class="toctree-l1"><a class="reference internal" href="../data-storage/data-store-dbms.html">The Usergrid Data Store</a></li> +<li class="toctree-l1"><a class="reference internal" href="../data-storage/optimizing-access.html">Data Store Best Practices</a></li> +<li class="toctree-l1"><a class="reference internal" href="../data-storage/collections.html">Collections</a></li> +<li class="toctree-l1"><a class="reference internal" href="../data-storage/entities.html">Entities</a></li> +</ul> +<p class="caption"><span class="caption-text">Data Queries</span></p> +<ul> +<li class="toctree-l1"><a class="reference internal" href="../data-queries/querying-your-data.html">Querying your data</a></li> +<li class="toctree-l1"><a class="reference internal" href="../data-queries/query-parameters.html">Query parameters & clauses</a></li> +<li class="toctree-l1"><a class="reference internal" href="../data-queries/operators-and-types.html">Query operators & data types</a></li> +<li class="toctree-l1"><a class="reference internal" href="../data-queries/advanced-query-usage.html">Advanced query usage</a></li> +</ul> +<p class="caption"><span class="caption-text">Entity Connections</span></p> +<ul> +<li class="toctree-l1"><a class="reference internal" href="../entity-connections/connecting-entities.html">Connecting entities</a></li> +<li class="toctree-l1"><a class="reference internal" href="../entity-connections/retrieving-entities.html">Retrieving connections</a></li> +<li class="toctree-l1"><a class="reference internal" href="../entity-connections/disconnecting-entities.html">Disconnecting entities</a></li> +</ul> +<p class="caption"><span class="caption-text">Security & Authentication</span></p> +<ul> +<li class="toctree-l1"><a class="reference internal" href="../security-and-auth/app-security.html">Security & token authentication</a></li> +<li class="toctree-l1"><a class="reference internal" href="../security-and-auth/using-permissions.html">Using permissions</a></li> +<li class="toctree-l1"><a class="reference internal" href="../security-and-auth/authenticating-users-and-application-clients.html">Authenticating users & app clients</a></li> +<li class="toctree-l1"><a class="reference internal" href="../security-and-auth/user-authentication-types.html">Authentication levels</a></li> +<li class="toctree-l1"><a class="reference internal" href="../security-and-auth/changing-token-time-live-ttl.html">Changing token expiration (time-to-live)</a></li> +<li class="toctree-l1"><a class="reference internal" href="../security-and-auth/authenticating-api-requests.html">Authenticating API requests</a></li> +<li class="toctree-l1"><a class="reference internal" href="../security-and-auth/revoking-tokens-logout.html">Revoking tokens (logout)</a></li> +<li class="toctree-l1"><a class="reference internal" href="../security-and-auth/facebook-sign.html">Facebook sign in</a></li> +<li class="toctree-l1"><a class="reference internal" href="../security-and-auth/securing-your-app.html">Security best practices</a></li> +</ul> +<p class="caption"><span class="caption-text">User Management & Social Graph</span></p> +<ul> +<li class="toctree-l1"><a class="reference internal" href="../user-management/user-management.html">User management & social graph</a></li> +<li class="toctree-l1"><a class="reference internal" href="../user-management/working-user-data.html">Working with User Data</a></li> +<li class="toctree-l1"><a class="reference internal" href="../user-management/group.html">Working with group data</a></li> +<li class="toctree-l1"><a class="reference internal" href="../user-management/activity.html">Activity</a></li> +<li class="toctree-l1"><a class="reference internal" href="../user-management/user-connections.html">Social Graph Connections</a></li> +<li class="toctree-l1"><a class="reference internal" href="../user-management/user-connections.html#creating-other-connections">Creating other connections</a></li> +<li class="toctree-l1"><a class="reference internal" href="../user-management/messagee-example.html">App Example - Messagee</a></li> +</ul> +<p class="caption"><span class="caption-text">Geo-location</span></p> +<ul> +<li class="toctree-l1"><a class="reference internal" href="../geolocation/geolocation.html">Geolocating your Entities</a></li> +</ul> +<p class="caption"><span class="caption-text">Assets & Files</span></p> +<ul> +<li class="toctree-l1"><a class="reference internal" href="../asset-and-files/uploading-assets.html">Uploading assets</a></li> +<li class="toctree-l1"><a class="reference internal" href="../asset-and-files/retrieving-assets.html">Retrieving assets</a></li> +<li class="toctree-l1"><a class="reference internal" href="../asset-and-files/folders.html">Folders</a></li> +</ul> +<p class="caption"><span class="caption-text">Counters & Events</span></p> +<ul class="current"> +<li class="toctree-l1"><a class="reference internal" href="events-and-counters.html">Counters & events</a></li> +<li class="toctree-l1 current"><a class="current reference internal" href="">Creating & incrementing counters</a><ul> +<li class="toctree-l2"><a class="reference internal" href="#request-syntax">Request syntax</a></li> +<li class="toctree-l2"><a class="reference internal" href="#example-request">Example request</a></li> +<li class="toctree-l2"><a class="reference internal" href="#example-response">Example response</a></li> +</ul> +</li> +<li class="toctree-l1"><a class="reference internal" href="#decrementing-resetting-counters">Decrementing/resetting counters</a></li> +<li class="toctree-l1"><a class="reference internal" href="#using-counters-hierarchically">Using counters hierarchically</a></li> +<li class="toctree-l1"><a class="reference internal" href="retrieving-counters.html">Retrieving counters</a></li> +</ul> +<p class="caption"><span class="caption-text">Organizations & Applications</span></p> +<ul> +<li class="toctree-l1"><a class="reference internal" href="../orgs-and-apps/managing.html">Organization & application management</a></li> +<li class="toctree-l1"><a class="reference internal" href="../orgs-and-apps/organization.html">Organization</a></li> +<li class="toctree-l1"><a class="reference internal" href="../orgs-and-apps/application.html">Application</a></li> +</ul> +<p class="caption"><span class="caption-text">API Reference</span></p> +<ul> +<li class="toctree-l1"><a class="reference internal" href="../rest-endpoints/api-docs.html">Methods</a></li> +<li class="toctree-l1"><a class="reference internal" href="../rest-endpoints/api-docs.html#models">Models</a></li> +</ul> +<p class="caption"><span class="caption-text">Client SDKs</span></p> +<ul> +<li class="toctree-l1"><a class="reference internal" href="../sdks/tbd.html">COMING SOON...</a></li> +</ul> +<p class="caption"><span class="caption-text">Installing the Stack</span></p> +<ul> +<li class="toctree-l1"><a class="reference internal" href="../installation/ug1-deploy-to-tomcat.html">Usegrid 1: Deploying to Tomcat</a></li> +<li class="toctree-l1"><a class="reference internal" href="../installation/ug1-launcher-quick-start.html">Usegrid 1: Launcher Quick-start</a></li> +<li class="toctree-l1"><a class="reference internal" href="../installation/ug2-deploy-to-tomcat.html">Usergrid 2: Deploy to Tomcat</a></li> +</ul> +<p class="caption"><span class="caption-text">More about Usergrid</span></p> +<ul> +<li class="toctree-l1"><a class="reference internal" href="../reference/presos-and-videos.html">Presentations & Videos</a></li> +<li class="toctree-l1"><a class="reference internal" href="../reference/contribute-code.html">How to Contribute Code & Docs</a></li> +</ul> + + + + </div> + + </nav> + + <section data-toggle="wy-nav-shift" class="wy-nav-content-wrap"> + + + <nav class="wy-nav-top" role="navigation" aria-label="top navigation"> + <i data-toggle="wy-nav-top" class="fa fa-bars"></i> + <a href="../index.html">Apache Usergrid</a> + </nav> + + + + <div class="wy-nav-content"> + <div class="rst-content"> + <div role="navigation" aria-label="breadcrumbs navigation"> + <ul class="wy-breadcrumbs"> + <li><a href="../index.html">Docs</a> »</li> + + <li>Creating & incrementing counters</li> + <li class="wy-breadcrumbs-aside"> + + + <a href="../_sources/counters-and-events/creating-and-incrementing-counters.txt" rel="nofollow"> View page source</a> + + + </li> + </ul> + <hr/> +</div> + <div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article"> + <div itemprop="articleBody"> + + <div class="section" id="creating-incrementing-counters"> +<h1>Creating & incrementing counters<a class="headerlink" href="#creating-incrementing-counters" title="Permalink to this headline">¶</a></h1> +<p>To create a new counter or increment an existing counter, include the +counter property in the body of a POST to the /events endpoint. More +than one counter can be incremented in the same request.</p> +<p><strong>Note</strong>: It may take up to 30 seconds after an event has been posted +for the counter to be incremented.</p> +<div class="section" id="request-syntax"> +<h2>Request syntax<a class="headerlink" href="#request-syntax" title="Permalink to this headline">¶</a></h2> +<div class="highlight-python"><div class="highlight"><pre>curl -X POST https://api.usergrid.com/<org>/<app>/events -d '{"timestamp":<timestamp>, "counters" : {<counter_name>:<increment_value>}}' +</pre></div> +</div> +<p>Parameters</p> +<table border="1" class="docutils"> +<colgroup> +<col width="19%" /> +<col width="81%" /> +</colgroup> +<thead valign="bottom"> +<tr class="row-odd"><th class="head">Parameter</th> +<th class="head">Description</th> +</tr> +</thead> +<tbody valign="top"> +<tr class="row-even"><td>org</td> +<td>Organization UUID or organization name</td> +</tr> +<tr class="row-odd"><td>app</td> +<td>Application UUID or application name</td> +</tr> +<tr class="row-even"><td>timestamp</td> +<td>A required UNIX timestamp that specifies the time the counter is being incremented.</td> +</tr> +<tr class="row-odd"><td>counter_name</td> +<td>The name of the counter to create or the existing counter to increment.</td> +</tr> +<tr class="row-even"><td>increment_value</td> +<td>The value to increment the counter by.</td> +</tr> +</tbody> +</table> +<p>Regarding the <code class="docutils literal"><span class="pre">increment_value</span></code>, a negative number can be specified to +decrement the value. A value of ‘0’ can be specified to reset the value +of the counter.</p> +<p>For the <code class="docutils literal"><span class="pre">timestamp</span></code>, specifying a value of 0 will automatically assign +the current time.</p> +</div> +<div class="section" id="example-request"> +<h2>Example request<a class="headerlink" href="#example-request" title="Permalink to this headline">¶</a></h2> +<p>The following request will increment the ‘button_clicks’ counter by +one, with a timestamp of the current time.</p> +<div class="highlight-python"><div class="highlight"><pre>curl -X POST https://api.usergrid.com/your-org/your-app/events -d '{"timestamp":0, "counters" : {"button_clicks":1}}' +</pre></div> +</div> +</div> +<div class="section" id="example-response"> +<h2>Example response<a class="headerlink" href="#example-response" title="Permalink to this headline">¶</a></h2> +<div class="highlight-python"><div class="highlight"><pre><span class="p">{</span> + <span class="s">"action"</span> <span class="p">:</span> <span class="s">"post"</span><span class="p">,</span> + <span class="s">"application"</span> <span class="p">:</span> <span class="s">"f34f4222-a166-11e2-a7f7-02e81adcf3d0"</span><span class="p">,</span> + <span class="s">"params"</span> <span class="p">:</span> <span class="p">{</span> <span class="p">},</span> + <span class="s">"path"</span> <span class="p">:</span> <span class="s">"/events"</span><span class="p">,</span> + <span class="s">"uri"</span> <span class="p">:</span> <span class="s">"https://api.usergrid.com/your-org/your-app/events"</span><span class="p">,</span> + <span class="s">"entities"</span> <span class="p">:</span> <span class="p">[</span> <span class="p">{</span> + <span class="s">"uuid"</span> <span class="p">:</span> <span class="s">"b11217fc-9d3a-1427-b24e-699740088e05"</span><span class="p">,</span> + <span class="s">"type"</span> <span class="p">:</span> <span class="s">"event"</span><span class="p">,</span> + <span class="s">"created"</span> <span class="p">:</span> <span class="mi">1401224590293</span><span class="p">,</span> + <span class="s">"modified"</span> <span class="p">:</span> <span class="mi">1401224590293</span><span class="p">,</span> + <span class="s">"timestamp"</span> <span class="p">:</span> <span class="mi">1401224590293</span><span class="p">,</span> + <span class="s">"counters"</span> <span class="p">:</span> <span class="p">{</span> + <span class="s">"button_clicks"</span> <span class="p">:</span> <span class="mi">1</span> + <span class="p">},</span> + <span class="s">"message"</span> <span class="p">:</span> <span class="n">null</span><span class="p">,</span> + <span class="s">"metadata"</span> <span class="p">:</span> <span class="p">{</span> + <span class="s">"path"</span> <span class="p">:</span> <span class="s">"/events/b11217fc-9d3a-1427-b24e-699740088e05"</span> + <span class="p">}</span> + <span class="p">}</span> <span class="p">],</span> + <span class="s">"timestamp"</span> <span class="p">:</span> <span class="mi">1401224590291</span><span class="p">,</span> + <span class="s">"duration"</span> <span class="p">:</span> <span class="mi">30</span><span class="p">,</span> + <span class="s">"organization"</span> <span class="p">:</span> <span class="s">"your-org"</span><span class="p">,</span> + <span class="s">"applicationName"</span> <span class="p">:</span> <span class="s">"your-app"</span> +<span class="p">}</span> +</pre></div> +</div> +</div> +</div> +<div class="section" id="decrementing-resetting-counters"> +<h1>Decrementing/resetting counters<a class="headerlink" href="#decrementing-resetting-counters" title="Permalink to this headline">¶</a></h1> +<p>To decrement a counter, specify a negative number for the counter value +in any of the above examples.</p> +<p>To reset a counter, specify a value of 0 for the counter value in any of +the above examples.</p> +<p>Note that the Usergrid JavaScript SDK also provides dedicated methods +for decrementing and resetting counters.</p> +</div> +<div class="section" id="using-counters-hierarchically"> +<h1>Using counters hierarchically<a class="headerlink" href="#using-counters-hierarchically" title="Permalink to this headline">¶</a></h1> +<p>You can organize counters into hierarchies by giving them dot-separated +names, e.g. <code class="docutils literal"><span class="pre">button_clicks.homepage</span></code>. Incrementing a counter lower in +a hierarchy increments all of the counters upward in the hierarchy +chain.</p> +<p>For example, you want to log errors that your app generates, so you +create hierarchical counters for each module and function within that +module. In this example, you create the following set of counters:</p> +<div class="highlight-python"><div class="highlight"><pre><span class="n">errors</span> +<span class="n">errors</span><span class="o">.</span><span class="n">module</span> +<span class="n">errors</span><span class="o">.</span><span class="n">module</span><span class="o">.</span><span class="n">function</span> +</pre></div> +</div> +<p>Incrementing <code class="docutils literal"><span class="pre">errors.module.function</span></code> by 1 increments all three +counters by 1. A hierarchy can be a useful way of easily tracking +actions in your app at both a cumulative and granular level.</p> +</div> + + + </div> + </div> + <footer> + + <div class="rst-footer-buttons" role="navigation" aria-label="footer navigation"> + + <a href="retrieving-counters.html" class="btn btn-neutral float-right" title="Retrieving counters" accesskey="n">Next <span class="fa fa-arrow-circle-right"></span></a> + + + <a href="events-and-counters.html" class="btn btn-neutral" title="Counters & events" accesskey="p"><span class="fa fa-arrow-circle-left"></span> Previous</a> + + </div> + + + <hr/> + + <div role="contentinfo"> + <p> + © Copyright 2013-2015, Apache Usergrid. + + </p> + </div> + Built with <a href="http://sphinx-doc.org/">Sphinx</a> using a <a href="https://github.com/snide/sphinx_rtd_theme">theme</a> provided by <a href="https://readthedocs.org">Read the Docs</a>. + +</footer> + + </div> + </div> + + </section> + + </div> + + + + + + <script type="text/javascript"> + var DOCUMENTATION_OPTIONS = { + URL_ROOT:'../', + VERSION:'1.0', + COLLAPSE_INDEX:false, + FILE_SUFFIX:'.html', + HAS_SOURCE: true + }; + </script> + <script type="text/javascript" src="../_static/jquery.js"></script> + <script type="text/javascript" src="../_static/underscore.js"></script> + <script type="text/javascript" src="../_static/doctools.js"></script> + + + + + + <script type="text/javascript" src="../_static/js/theme.js"></script> + + + + + <script type="text/javascript"> + jQuery(function () { + SphinxRtdTheme.StickyNav.enable(); + }); + </script> + + +</body> +</html> \ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/4a92ab09/content/docs/counters-and-events/events-and-counters.html ---------------------------------------------------------------------- diff --git a/content/docs/counters-and-events/events-and-counters.html b/content/docs/counters-and-events/events-and-counters.html new file mode 100644 index 0000000..d759fc5 --- /dev/null +++ b/content/docs/counters-and-events/events-and-counters.html @@ -0,0 +1,303 @@ + + +<!DOCTYPE html> +<!--[if IE 8]><html class="no-js lt-ie9" lang="en" > <![endif]--> +<!--[if gt IE 8]><!--> <html class="no-js" lang="en" > <!--<![endif]--> +<head> + <meta charset="utf-8"> + + <meta name="viewport" content="width=device-width, initial-scale=1.0"> + + <title>Counters & events — Apache Usergrid 1.0 documentation</title> + + + + + + + + + + + + + + + + <link rel="stylesheet" href="../_static/css/theme.css" type="text/css" /> + + + + + + <link rel="top" title="Apache Usergrid 1.0 documentation" href="../index.html"/> + <link rel="next" title="Creating & incrementing counters" href="creating-and-incrementing-counters.html"/> + <link rel="prev" title="Folders" href="../asset-and-files/folders.html"/> + + + <script src="../_static/js/modernizr.min.js"></script> + +</head> + +<body class="wy-body-for-nav" role="document"> + + <div class="wy-grid-for-nav"> + + + <nav data-toggle="wy-nav-shift" class="wy-nav-side"> + <div class="wy-side-nav-search"> + + + + <a href="../index.html" class="icon icon-home"> Apache Usergrid + + + + </a> + + + + + <div class="version"> + 1.0 + </div> + + + + +<div role="search"> + <form id="rtd-search-form" class="wy-form" action="../search.html" method="get"> + <input type="text" name="q" placeholder="Search docs" /> + <input type="hidden" name="check_keywords" value="yes" /> + <input type="hidden" name="area" value="default" /> + </form> +</div> + + + </div> + + <div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation"> + + + + <p class="caption"><span class="caption-text">Introduction</span></p> +<ul> +<li class="toctree-l1"><a class="reference internal" href="../introduction/usergrid-features.html">Usergrid Features</a></li> +<li class="toctree-l1"><a class="reference internal" href="../introduction/data-model.html">Usergrid Data model</a></li> +<li class="toctree-l1"><a class="reference internal" href="../introduction/async-vs-sync.html">Async vs. sync calls</a></li> +</ul> +<p class="caption"><span class="caption-text">Getting Started</span></p> +<ul> +<li class="toctree-l1"><a class="reference internal" href="../getting-started/creating-a-new-application.html">Creating a new application</a></li> +<li class="toctree-l1"><a class="reference internal" href="../getting-started/creating-account.html">Creating an Usergrid Account</a></li> +<li class="toctree-l1"><a class="reference internal" href="../getting-started/using-a-sandbox-app.html">Using a Sandbox Application</a></li> +<li class="toctree-l1"><a class="reference internal" href="../getting-started/using-the-api.html">Using the API</a></li> +</ul> +<p class="caption"><span class="caption-text">Data Storage</span></p> +<ul> +<li class="toctree-l1"><a class="reference internal" href="../data-storage/data-store-dbms.html">The Usergrid Data Store</a></li> +<li class="toctree-l1"><a class="reference internal" href="../data-storage/optimizing-access.html">Data Store Best Practices</a></li> +<li class="toctree-l1"><a class="reference internal" href="../data-storage/collections.html">Collections</a></li> +<li class="toctree-l1"><a class="reference internal" href="../data-storage/entities.html">Entities</a></li> +</ul> +<p class="caption"><span class="caption-text">Data Queries</span></p> +<ul> +<li class="toctree-l1"><a class="reference internal" href="../data-queries/querying-your-data.html">Querying your data</a></li> +<li class="toctree-l1"><a class="reference internal" href="../data-queries/query-parameters.html">Query parameters & clauses</a></li> +<li class="toctree-l1"><a class="reference internal" href="../data-queries/operators-and-types.html">Query operators & data types</a></li> +<li class="toctree-l1"><a class="reference internal" href="../data-queries/advanced-query-usage.html">Advanced query usage</a></li> +</ul> +<p class="caption"><span class="caption-text">Entity Connections</span></p> +<ul> +<li class="toctree-l1"><a class="reference internal" href="../entity-connections/connecting-entities.html">Connecting entities</a></li> +<li class="toctree-l1"><a class="reference internal" href="../entity-connections/retrieving-entities.html">Retrieving connections</a></li> +<li class="toctree-l1"><a class="reference internal" href="../entity-connections/disconnecting-entities.html">Disconnecting entities</a></li> +</ul> +<p class="caption"><span class="caption-text">Security & Authentication</span></p> +<ul> +<li class="toctree-l1"><a class="reference internal" href="../security-and-auth/app-security.html">Security & token authentication</a></li> +<li class="toctree-l1"><a class="reference internal" href="../security-and-auth/using-permissions.html">Using permissions</a></li> +<li class="toctree-l1"><a class="reference internal" href="../security-and-auth/authenticating-users-and-application-clients.html">Authenticating users & app clients</a></li> +<li class="toctree-l1"><a class="reference internal" href="../security-and-auth/user-authentication-types.html">Authentication levels</a></li> +<li class="toctree-l1"><a class="reference internal" href="../security-and-auth/changing-token-time-live-ttl.html">Changing token expiration (time-to-live)</a></li> +<li class="toctree-l1"><a class="reference internal" href="../security-and-auth/authenticating-api-requests.html">Authenticating API requests</a></li> +<li class="toctree-l1"><a class="reference internal" href="../security-and-auth/revoking-tokens-logout.html">Revoking tokens (logout)</a></li> +<li class="toctree-l1"><a class="reference internal" href="../security-and-auth/facebook-sign.html">Facebook sign in</a></li> +<li class="toctree-l1"><a class="reference internal" href="../security-and-auth/securing-your-app.html">Security best practices</a></li> +</ul> +<p class="caption"><span class="caption-text">User Management & Social Graph</span></p> +<ul> +<li class="toctree-l1"><a class="reference internal" href="../user-management/user-management.html">User management & social graph</a></li> +<li class="toctree-l1"><a class="reference internal" href="../user-management/working-user-data.html">Working with User Data</a></li> +<li class="toctree-l1"><a class="reference internal" href="../user-management/group.html">Working with group data</a></li> +<li class="toctree-l1"><a class="reference internal" href="../user-management/activity.html">Activity</a></li> +<li class="toctree-l1"><a class="reference internal" href="../user-management/user-connections.html">Social Graph Connections</a></li> +<li class="toctree-l1"><a class="reference internal" href="../user-management/user-connections.html#creating-other-connections">Creating other connections</a></li> +<li class="toctree-l1"><a class="reference internal" href="../user-management/messagee-example.html">App Example - Messagee</a></li> +</ul> +<p class="caption"><span class="caption-text">Geo-location</span></p> +<ul> +<li class="toctree-l1"><a class="reference internal" href="../geolocation/geolocation.html">Geolocating your Entities</a></li> +</ul> +<p class="caption"><span class="caption-text">Assets & Files</span></p> +<ul> +<li class="toctree-l1"><a class="reference internal" href="../asset-and-files/uploading-assets.html">Uploading assets</a></li> +<li class="toctree-l1"><a class="reference internal" href="../asset-and-files/retrieving-assets.html">Retrieving assets</a></li> +<li class="toctree-l1"><a class="reference internal" href="../asset-and-files/folders.html">Folders</a></li> +</ul> +<p class="caption"><span class="caption-text">Counters & Events</span></p> +<ul class="current"> +<li class="toctree-l1 current"><a class="current reference internal" href="">Counters & events</a></li> +<li class="toctree-l1"><a class="reference internal" href="creating-and-incrementing-counters.html">Creating & incrementing counters</a></li> +<li class="toctree-l1"><a class="reference internal" href="creating-and-incrementing-counters.html#decrementing-resetting-counters">Decrementing/resetting counters</a></li> +<li class="toctree-l1"><a class="reference internal" href="creating-and-incrementing-counters.html#using-counters-hierarchically">Using counters hierarchically</a></li> +<li class="toctree-l1"><a class="reference internal" href="retrieving-counters.html">Retrieving counters</a></li> +</ul> +<p class="caption"><span class="caption-text">Organizations & Applications</span></p> +<ul> +<li class="toctree-l1"><a class="reference internal" href="../orgs-and-apps/managing.html">Organization & application management</a></li> +<li class="toctree-l1"><a class="reference internal" href="../orgs-and-apps/organization.html">Organization</a></li> +<li class="toctree-l1"><a class="reference internal" href="../orgs-and-apps/application.html">Application</a></li> +</ul> +<p class="caption"><span class="caption-text">API Reference</span></p> +<ul> +<li class="toctree-l1"><a class="reference internal" href="../rest-endpoints/api-docs.html">Methods</a></li> +<li class="toctree-l1"><a class="reference internal" href="../rest-endpoints/api-docs.html#models">Models</a></li> +</ul> +<p class="caption"><span class="caption-text">Client SDKs</span></p> +<ul> +<li class="toctree-l1"><a class="reference internal" href="../sdks/tbd.html">COMING SOON...</a></li> +</ul> +<p class="caption"><span class="caption-text">Installing the Stack</span></p> +<ul> +<li class="toctree-l1"><a class="reference internal" href="../installation/ug1-deploy-to-tomcat.html">Usegrid 1: Deploying to Tomcat</a></li> +<li class="toctree-l1"><a class="reference internal" href="../installation/ug1-launcher-quick-start.html">Usegrid 1: Launcher Quick-start</a></li> +<li class="toctree-l1"><a class="reference internal" href="../installation/ug2-deploy-to-tomcat.html">Usergrid 2: Deploy to Tomcat</a></li> +</ul> +<p class="caption"><span class="caption-text">More about Usergrid</span></p> +<ul> +<li class="toctree-l1"><a class="reference internal" href="../reference/presos-and-videos.html">Presentations & Videos</a></li> +<li class="toctree-l1"><a class="reference internal" href="../reference/contribute-code.html">How to Contribute Code & Docs</a></li> +</ul> + + + + </div> + + </nav> + + <section data-toggle="wy-nav-shift" class="wy-nav-content-wrap"> + + + <nav class="wy-nav-top" role="navigation" aria-label="top navigation"> + <i data-toggle="wy-nav-top" class="fa fa-bars"></i> + <a href="../index.html">Apache Usergrid</a> + </nav> + + + + <div class="wy-nav-content"> + <div class="rst-content"> + <div role="navigation" aria-label="breadcrumbs navigation"> + <ul class="wy-breadcrumbs"> + <li><a href="../index.html">Docs</a> »</li> + + <li>Counters & events</li> + <li class="wy-breadcrumbs-aside"> + + + <a href="../_sources/counters-and-events/events-and-counters.txt" rel="nofollow"> View page source</a> + + + </li> + </ul> + <hr/> +</div> + <div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article"> + <div itemprop="articleBody"> + + <div class="section" id="counters-events"> +<h1>Counters & events<a class="headerlink" href="#counters-events" title="Permalink to this headline">¶</a></h1> +<p>Counters can be used to track statistics on many aspects of an +application by keeping a running count of the number of times an action +occurs in your app. Posting an event increments the counter. Counters +can also be retrieved by time period, allowing you to generate reports +on specific actions in your app.</p> +<p>With Usergrid, you can define your own counters. Some of the things that +you might track with a user-defined counter are:</p> +<ul class="simple"> +<li>How many times people click on the help button in your application.</li> +<li>How many times your game is played each day.</li> +<li>How many times your banner ads are clicked each day.</li> +</ul> +</div> + + + </div> + </div> + <footer> + + <div class="rst-footer-buttons" role="navigation" aria-label="footer navigation"> + + <a href="creating-and-incrementing-counters.html" class="btn btn-neutral float-right" title="Creating & incrementing counters" accesskey="n">Next <span class="fa fa-arrow-circle-right"></span></a> + + + <a href="../asset-and-files/folders.html" class="btn btn-neutral" title="Folders" accesskey="p"><span class="fa fa-arrow-circle-left"></span> Previous</a> + + </div> + + + <hr/> + + <div role="contentinfo"> + <p> + © Copyright 2013-2015, Apache Usergrid. + + </p> + </div> + Built with <a href="http://sphinx-doc.org/">Sphinx</a> using a <a href="https://github.com/snide/sphinx_rtd_theme">theme</a> provided by <a href="https://readthedocs.org">Read the Docs</a>. + +</footer> + + </div> + </div> + + </section> + + </div> + + + + + + <script type="text/javascript"> + var DOCUMENTATION_OPTIONS = { + URL_ROOT:'../', + VERSION:'1.0', + COLLAPSE_INDEX:false, + FILE_SUFFIX:'.html', + HAS_SOURCE: true + }; + </script> + <script type="text/javascript" src="../_static/jquery.js"></script> + <script type="text/javascript" src="../_static/underscore.js"></script> + <script type="text/javascript" src="../_static/doctools.js"></script> + + + + + + <script type="text/javascript" src="../_static/js/theme.js"></script> + + + + + <script type="text/javascript"> + jQuery(function () { + SphinxRtdTheme.StickyNav.enable(); + }); + </script> + + +</body> +</html> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/4a92ab09/content/docs/counters-and-events/retrieving-counters.html ---------------------------------------------------------------------- diff --git a/content/docs/counters-and-events/retrieving-counters.html b/content/docs/counters-and-events/retrieving-counters.html new file mode 100644 index 0000000..9eff15a --- /dev/null +++ b/content/docs/counters-and-events/retrieving-counters.html @@ -0,0 +1,458 @@ + + +<!DOCTYPE html> +<!--[if IE 8]><html class="no-js lt-ie9" lang="en" > <![endif]--> +<!--[if gt IE 8]><!--> <html class="no-js" lang="en" > <!--<![endif]--> +<head> + <meta charset="utf-8"> + + <meta name="viewport" content="width=device-width, initial-scale=1.0"> + + <title>Retrieving counters — Apache Usergrid 1.0 documentation</title> + + + + + + + + + + + + + + + + <link rel="stylesheet" href="../_static/css/theme.css" type="text/css" /> + + + + + + <link rel="top" title="Apache Usergrid 1.0 documentation" href="../index.html"/> + <link rel="next" title="Organization & application management" href="../orgs-and-apps/managing.html"/> + <link rel="prev" title="Creating & incrementing counters" href="creating-and-incrementing-counters.html"/> + + + <script src="../_static/js/modernizr.min.js"></script> + +</head> + +<body class="wy-body-for-nav" role="document"> + + <div class="wy-grid-for-nav"> + + + <nav data-toggle="wy-nav-shift" class="wy-nav-side"> + <div class="wy-side-nav-search"> + + + + <a href="../index.html" class="icon icon-home"> Apache Usergrid + + + + </a> + + + + + <div class="version"> + 1.0 + </div> + + + + +<div role="search"> + <form id="rtd-search-form" class="wy-form" action="../search.html" method="get"> + <input type="text" name="q" placeholder="Search docs" /> + <input type="hidden" name="check_keywords" value="yes" /> + <input type="hidden" name="area" value="default" /> + </form> +</div> + + + </div> + + <div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation"> + + + + <p class="caption"><span class="caption-text">Introduction</span></p> +<ul> +<li class="toctree-l1"><a class="reference internal" href="../introduction/usergrid-features.html">Usergrid Features</a></li> +<li class="toctree-l1"><a class="reference internal" href="../introduction/data-model.html">Usergrid Data model</a></li> +<li class="toctree-l1"><a class="reference internal" href="../introduction/async-vs-sync.html">Async vs. sync calls</a></li> +</ul> +<p class="caption"><span class="caption-text">Getting Started</span></p> +<ul> +<li class="toctree-l1"><a class="reference internal" href="../getting-started/creating-a-new-application.html">Creating a new application</a></li> +<li class="toctree-l1"><a class="reference internal" href="../getting-started/creating-account.html">Creating an Usergrid Account</a></li> +<li class="toctree-l1"><a class="reference internal" href="../getting-started/using-a-sandbox-app.html">Using a Sandbox Application</a></li> +<li class="toctree-l1"><a class="reference internal" href="../getting-started/using-the-api.html">Using the API</a></li> +</ul> +<p class="caption"><span class="caption-text">Data Storage</span></p> +<ul> +<li class="toctree-l1"><a class="reference internal" href="../data-storage/data-store-dbms.html">The Usergrid Data Store</a></li> +<li class="toctree-l1"><a class="reference internal" href="../data-storage/optimizing-access.html">Data Store Best Practices</a></li> +<li class="toctree-l1"><a class="reference internal" href="../data-storage/collections.html">Collections</a></li> +<li class="toctree-l1"><a class="reference internal" href="../data-storage/entities.html">Entities</a></li> +</ul> +<p class="caption"><span class="caption-text">Data Queries</span></p> +<ul> +<li class="toctree-l1"><a class="reference internal" href="../data-queries/querying-your-data.html">Querying your data</a></li> +<li class="toctree-l1"><a class="reference internal" href="../data-queries/query-parameters.html">Query parameters & clauses</a></li> +<li class="toctree-l1"><a class="reference internal" href="../data-queries/operators-and-types.html">Query operators & data types</a></li> +<li class="toctree-l1"><a class="reference internal" href="../data-queries/advanced-query-usage.html">Advanced query usage</a></li> +</ul> +<p class="caption"><span class="caption-text">Entity Connections</span></p> +<ul> +<li class="toctree-l1"><a class="reference internal" href="../entity-connections/connecting-entities.html">Connecting entities</a></li> +<li class="toctree-l1"><a class="reference internal" href="../entity-connections/retrieving-entities.html">Retrieving connections</a></li> +<li class="toctree-l1"><a class="reference internal" href="../entity-connections/disconnecting-entities.html">Disconnecting entities</a></li> +</ul> +<p class="caption"><span class="caption-text">Security & Authentication</span></p> +<ul> +<li class="toctree-l1"><a class="reference internal" href="../security-and-auth/app-security.html">Security & token authentication</a></li> +<li class="toctree-l1"><a class="reference internal" href="../security-and-auth/using-permissions.html">Using permissions</a></li> +<li class="toctree-l1"><a class="reference internal" href="../security-and-auth/authenticating-users-and-application-clients.html">Authenticating users & app clients</a></li> +<li class="toctree-l1"><a class="reference internal" href="../security-and-auth/user-authentication-types.html">Authentication levels</a></li> +<li class="toctree-l1"><a class="reference internal" href="../security-and-auth/changing-token-time-live-ttl.html">Changing token expiration (time-to-live)</a></li> +<li class="toctree-l1"><a class="reference internal" href="../security-and-auth/authenticating-api-requests.html">Authenticating API requests</a></li> +<li class="toctree-l1"><a class="reference internal" href="../security-and-auth/revoking-tokens-logout.html">Revoking tokens (logout)</a></li> +<li class="toctree-l1"><a class="reference internal" href="../security-and-auth/facebook-sign.html">Facebook sign in</a></li> +<li class="toctree-l1"><a class="reference internal" href="../security-and-auth/securing-your-app.html">Security best practices</a></li> +</ul> +<p class="caption"><span class="caption-text">User Management & Social Graph</span></p> +<ul> +<li class="toctree-l1"><a class="reference internal" href="../user-management/user-management.html">User management & social graph</a></li> +<li class="toctree-l1"><a class="reference internal" href="../user-management/working-user-data.html">Working with User Data</a></li> +<li class="toctree-l1"><a class="reference internal" href="../user-management/group.html">Working with group data</a></li> +<li class="toctree-l1"><a class="reference internal" href="../user-management/activity.html">Activity</a></li> +<li class="toctree-l1"><a class="reference internal" href="../user-management/user-connections.html">Social Graph Connections</a></li> +<li class="toctree-l1"><a class="reference internal" href="../user-management/user-connections.html#creating-other-connections">Creating other connections</a></li> +<li class="toctree-l1"><a class="reference internal" href="../user-management/messagee-example.html">App Example - Messagee</a></li> +</ul> +<p class="caption"><span class="caption-text">Geo-location</span></p> +<ul> +<li class="toctree-l1"><a class="reference internal" href="../geolocation/geolocation.html">Geolocating your Entities</a></li> +</ul> +<p class="caption"><span class="caption-text">Assets & Files</span></p> +<ul> +<li class="toctree-l1"><a class="reference internal" href="../asset-and-files/uploading-assets.html">Uploading assets</a></li> +<li class="toctree-l1"><a class="reference internal" href="../asset-and-files/retrieving-assets.html">Retrieving assets</a></li> +<li class="toctree-l1"><a class="reference internal" href="../asset-and-files/folders.html">Folders</a></li> +</ul> +<p class="caption"><span class="caption-text">Counters & Events</span></p> +<ul class="current"> +<li class="toctree-l1"><a class="reference internal" href="events-and-counters.html">Counters & events</a></li> +<li class="toctree-l1"><a class="reference internal" href="creating-and-incrementing-counters.html">Creating & incrementing counters</a></li> +<li class="toctree-l1"><a class="reference internal" href="creating-and-incrementing-counters.html#decrementing-resetting-counters">Decrementing/resetting counters</a></li> +<li class="toctree-l1"><a class="reference internal" href="creating-and-incrementing-counters.html#using-counters-hierarchically">Using counters hierarchically</a></li> +<li class="toctree-l1 current"><a class="current reference internal" href="">Retrieving counters</a><ul> +<li class="toctree-l2"><a class="reference internal" href="#request-syntax">Request syntax</a></li> +<li class="toctree-l2"><a class="reference internal" href="#example-request">Example request</a></li> +<li class="toctree-l2"><a class="reference internal" href="#example-response">Example response</a></li> +<li class="toctree-l2"><a class="reference internal" href="#retrieving-counters-by-time-interval">Retrieving counters by time interval</a></li> +<li class="toctree-l2"><a class="reference internal" href="#id1">Request syntax</a></li> +<li class="toctree-l2"><a class="reference internal" href="#id2">Example request</a></li> +<li class="toctree-l2"><a class="reference internal" href="#id3">Example response</a></li> +</ul> +</li> +</ul> +<p class="caption"><span class="caption-text">Organizations & Applications</span></p> +<ul> +<li class="toctree-l1"><a class="reference internal" href="../orgs-and-apps/managing.html">Organization & application management</a></li> +<li class="toctree-l1"><a class="reference internal" href="../orgs-and-apps/organization.html">Organization</a></li> +<li class="toctree-l1"><a class="reference internal" href="../orgs-and-apps/application.html">Application</a></li> +</ul> +<p class="caption"><span class="caption-text">API Reference</span></p> +<ul> +<li class="toctree-l1"><a class="reference internal" href="../rest-endpoints/api-docs.html">Methods</a></li> +<li class="toctree-l1"><a class="reference internal" href="../rest-endpoints/api-docs.html#models">Models</a></li> +</ul> +<p class="caption"><span class="caption-text">Client SDKs</span></p> +<ul> +<li class="toctree-l1"><a class="reference internal" href="../sdks/tbd.html">COMING SOON...</a></li> +</ul> +<p class="caption"><span class="caption-text">Installing the Stack</span></p> +<ul> +<li class="toctree-l1"><a class="reference internal" href="../installation/ug1-deploy-to-tomcat.html">Usegrid 1: Deploying to Tomcat</a></li> +<li class="toctree-l1"><a class="reference internal" href="../installation/ug1-launcher-quick-start.html">Usegrid 1: Launcher Quick-start</a></li> +<li class="toctree-l1"><a class="reference internal" href="../installation/ug2-deploy-to-tomcat.html">Usergrid 2: Deploy to Tomcat</a></li> +</ul> +<p class="caption"><span class="caption-text">More about Usergrid</span></p> +<ul> +<li class="toctree-l1"><a class="reference internal" href="../reference/presos-and-videos.html">Presentations & Videos</a></li> +<li class="toctree-l1"><a class="reference internal" href="../reference/contribute-code.html">How to Contribute Code & Docs</a></li> +</ul> + + + + </div> + + </nav> + + <section data-toggle="wy-nav-shift" class="wy-nav-content-wrap"> + + + <nav class="wy-nav-top" role="navigation" aria-label="top navigation"> + <i data-toggle="wy-nav-top" class="fa fa-bars"></i> + <a href="../index.html">Apache Usergrid</a> + </nav> + + + + <div class="wy-nav-content"> + <div class="rst-content"> + <div role="navigation" aria-label="breadcrumbs navigation"> + <ul class="wy-breadcrumbs"> + <li><a href="../index.html">Docs</a> »</li> + + <li>Retrieving counters</li> + <li class="wy-breadcrumbs-aside"> + + + <a href="../_sources/counters-and-events/retrieving-counters.txt" rel="nofollow"> View page source</a> + + + </li> + </ul> + <hr/> +</div> + <div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article"> + <div itemprop="articleBody"> + + <div class="section" id="retrieving-counters"> +<h1>Retrieving counters<a class="headerlink" href="#retrieving-counters" title="Permalink to this headline">¶</a></h1> +<p>To retrieve a counter, do the following:</p> +<div class="section" id="request-syntax"> +<h2>Request syntax<a class="headerlink" href="#request-syntax" title="Permalink to this headline">¶</a></h2> +<div class="highlight-python"><div class="highlight"><pre>curl -X GET https://api.usergrid.com/counters?counter=<counter_name> +</pre></div> +</div> +<p>Parameters</p> +<table border="1" class="docutils"> +<colgroup> +<col width="28%" /> +<col width="72%" /> +</colgroup> +<thead valign="bottom"> +<tr class="row-odd"><th class="head">Parameter</th> +<th class="head">Description</th> +</tr> +</thead> +<tbody valign="top"> +<tr class="row-even"><td>counter_name</td> +<td>The name of the counter to be retrieved.</td> +</tr> +</tbody> +</table> +<p>More than one counter can be retrieved with a single request by +appending additional counter parameters to the request URI.</p> +</div> +<div class="section" id="example-request"> +<h2>Example request<a class="headerlink" href="#example-request" title="Permalink to this headline">¶</a></h2> +<div class="highlight-python"><div class="highlight"><pre>curl -X GET https://api.usergrid.com/my-org/my-app/counters?counter=button_clicks +</pre></div> +</div> +</div> +<div class="section" id="example-response"> +<h2>Example response<a class="headerlink" href="#example-response" title="Permalink to this headline">¶</a></h2> +<div class="highlight-python"><div class="highlight"><pre><span class="p">{</span> + <span class="s">"action"</span> <span class="p">:</span> <span class="s">"get"</span><span class="p">,</span> + <span class="s">"application"</span> <span class="p">:</span> <span class="s">"f34f4222-a166-11e2-a7f7-02e81adcf3d0"</span><span class="p">,</span> + <span class="s">"params"</span> <span class="p">:</span> <span class="p">{</span> + <span class="s">"counter"</span> <span class="p">:</span> <span class="p">[</span> <span class="s">"button_clicks"</span> <span class="p">]</span> + <span class="p">},</span> + <span class="s">"uri"</span> <span class="p">:</span> <span class="s">"https://api.usergrid.com/your-org/your-app"</span><span class="p">,</span> + <span class="s">"entities"</span> <span class="p">:</span> <span class="p">[</span> <span class="p">],</span> + <span class="s">"timestamp"</span> <span class="p">:</span> <span class="mi">1401310084096</span><span class="p">,</span> + <span class="s">"duration"</span> <span class="p">:</span> <span class="mi">21</span><span class="p">,</span> + <span class="s">"organization"</span> <span class="p">:</span> <span class="s">"your-org"</span><span class="p">,</span> + <span class="s">"applicationName"</span> <span class="p">:</span> <span class="s">"your-app"</span><span class="p">,</span> + <span class="s">"count"</span> <span class="p">:</span> <span class="mi">0</span><span class="p">,</span> + <span class="s">"counters"</span> <span class="p">:</span> <span class="p">[</span> <span class="p">{</span> + <span class="s">"name"</span> <span class="p">:</span> <span class="s">"button_clicks"</span><span class="p">,</span> + <span class="s">"values"</span> <span class="p">:</span> <span class="p">[</span> <span class="p">{</span> + <span class="s">"timestamp"</span> <span class="p">:</span> <span class="mi">1</span><span class="p">,</span> + <span class="s">"value"</span> <span class="p">:</span> <span class="mi">9</span> + <span class="p">}</span> <span class="p">]</span> + <span class="p">}</span> <span class="p">]</span> +<span class="p">}</span> +</pre></div> +</div> +</div> +<div class="section" id="retrieving-counters-by-time-interval"> +<h2>Retrieving counters by time interval<a class="headerlink" href="#retrieving-counters-by-time-interval" title="Permalink to this headline">¶</a></h2> +<p>Knowing the value of a counter is useful; however, you often need to +know how the value varies over time. Fortunately, the API provides a +method for you to view this data over any time interval or level of +granularity.</p> +<p>For example, letâs say youâre incrementing a counter every time someone +launches your application. You might be interested in which days of the +week the application sees the most usage. Using the API, you can examine +the counter over a set of weeks, with the data split into daily +intervals. Using this information, you can see which are your peak days +of usage. You can also view usage across a single day, so you can see if +your application is used more in the mornings or the evenings.</p> +</div> +<div class="section" id="id1"> +<h2>Request syntax<a class="headerlink" href="#id1" title="Permalink to this headline">¶</a></h2> +<div class="highlight-python"><div class="highlight"><pre>curl -X GET https://api.usergrid.com/counters?start_time=<timestamp>&end_time=<timestamp>&resolution=<resolution>&counter=<counter_name> +</pre></div> +</div> +<p>Parameters</p> +<table border="1" class="docutils"> +<colgroup> +<col width="26%" /> +<col width="74%" /> +</colgroup> +<thead valign="bottom"> +<tr class="row-odd"><th class="head">Parameter</th> +<th class="head">Description</th> +</tr> +</thead> +<tbody valign="top"> +<tr class="row-even"><td>start_time</td> +<td>The beginning of the time period to search</td> +</tr> +<tr class="row-odd"><td>end_time</td> +<td>The end of the time period to search</td> +</tr> +<tr class="row-even"><td>resolution</td> +<td>The interval at which counters are displayed.</td> +</tr> +<tr class="row-odd"><td>counter_name</td> +<td>The name of the counter to be retrieved.</td> +</tr> +</tbody> +</table> +<p>The following resolutions are supported:</p> +<ul class="simple"> +<li>all</li> +<li>minute</li> +<li>five_minutes</li> +<li>half_hour</li> +<li>hour</li> +<li>six_day</li> +<li>day</li> +<li>week</li> +<li>month</li> +</ul> +<p>For example, if the interval is day, and the start time and end time +values span 4 days, you will get aggregate counts for each of the 4 +days.</p> +</div> +<div class="section" id="id2"> +<h2>Example request<a class="headerlink" href="#id2" title="Permalink to this headline">¶</a></h2> +<p>For example, to retrieve a time range of values, with a granularity of +“day”, for a counter called “button_clicks”, the GET request would look +like this:</p> +<div class="highlight-python"><div class="highlight"><pre>curl -X GET https://api.usergrid.com/my-org/my-app/counters?start_time=1315119600000&end_time=1315724400000&resolution=day&counter=button_clicks +</pre></div> +</div> +</div> +<div class="section" id="id3"> +<h2>Example response<a class="headerlink" href="#id3" title="Permalink to this headline">¶</a></h2> +<div class="highlight-python"><div class="highlight"><pre>{ + action: "get", + uri: "http://api.usergrid.com/438a1ca1-cf9b-11e0-bcc1-12313f0204bb/counters", + timestamp: 1315354369272, + duration: 28, + counters: [ + { + name: "button_clicks", + values: [ + { + value: 2 + timestamp: 1315180800000 + }, + { + value: 1 + timestamp: 1315267200000 + }, + { + value: 1 + timestamp: 1315353600000 + } + ] + } + ] +} +</pre></div> +</div> +</div> +</div> + + + </div> + </div> + <footer> + + <div class="rst-footer-buttons" role="navigation" aria-label="footer navigation"> + + <a href="../orgs-and-apps/managing.html" class="btn btn-neutral float-right" title="Organization & application management" accesskey="n">Next <span class="fa fa-arrow-circle-right"></span></a> + + + <a href="creating-and-incrementing-counters.html" class="btn btn-neutral" title="Creating & incrementing counters" accesskey="p"><span class="fa fa-arrow-circle-left"></span> Previous</a> + + </div> + + + <hr/> + + <div role="contentinfo"> + <p> + © Copyright 2013-2015, Apache Usergrid. + + </p> + </div> + Built with <a href="http://sphinx-doc.org/">Sphinx</a> using a <a href="https://github.com/snide/sphinx_rtd_theme">theme</a> provided by <a href="https://readthedocs.org">Read the Docs</a>. + +</footer> + + </div> + </div> + + </section> + + </div> + + + + + + <script type="text/javascript"> + var DOCUMENTATION_OPTIONS = { + URL_ROOT:'../', + VERSION:'1.0', + COLLAPSE_INDEX:false, + FILE_SUFFIX:'.html', + HAS_SOURCE: true + }; + </script> + <script type="text/javascript" src="../_static/jquery.js"></script> + <script type="text/javascript" src="../_static/underscore.js"></script> + <script type="text/javascript" src="../_static/doctools.js"></script> + + + + + + <script type="text/javascript" src="../_static/js/theme.js"></script> + + + + + <script type="text/javascript"> + jQuery(function () { + SphinxRtdTheme.StickyNav.enable(); + }); + </script> + + +</body> +</html> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/4a92ab09/content/docs/data-queries/advanced-query-usage.html ---------------------------------------------------------------------- diff --git a/content/docs/data-queries/advanced-query-usage.html b/content/docs/data-queries/advanced-query-usage.html new file mode 100644 index 0000000..7c1bfc1 --- /dev/null +++ b/content/docs/data-queries/advanced-query-usage.html @@ -0,0 +1,321 @@ + + +<!DOCTYPE html> +<!--[if IE 8]><html class="no-js lt-ie9" lang="en" > <![endif]--> +<!--[if gt IE 8]><!--> <html class="no-js" lang="en" > <!--<![endif]--> +<head> + <meta charset="utf-8"> + + <meta name="viewport" content="width=device-width, initial-scale=1.0"> + + <title>Advanced query usage — Apache Usergrid 1.0 documentation</title> + + + + + + + + + + + + + + + + <link rel="stylesheet" href="../_static/css/theme.css" type="text/css" /> + + + + + + <link rel="top" title="Apache Usergrid 1.0 documentation" href="../index.html"/> + <link rel="next" title="Connecting entities" href="../entity-connections/connecting-entities.html"/> + <link rel="prev" title="Query operators & data types" href="operators-and-types.html"/> + + + <script src="../_static/js/modernizr.min.js"></script> + +</head> + +<body class="wy-body-for-nav" role="document"> + + <div class="wy-grid-for-nav"> + + + <nav data-toggle="wy-nav-shift" class="wy-nav-side"> + <div class="wy-side-nav-search"> + + + + <a href="../index.html" class="icon icon-home"> Apache Usergrid + + + + </a> + + + + + <div class="version"> + 1.0 + </div> + + + + +<div role="search"> + <form id="rtd-search-form" class="wy-form" action="../search.html" method="get"> + <input type="text" name="q" placeholder="Search docs" /> + <input type="hidden" name="check_keywords" value="yes" /> + <input type="hidden" name="area" value="default" /> + </form> +</div> + + + </div> + + <div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation"> + + + + <p class="caption"><span class="caption-text">Introduction</span></p> +<ul> +<li class="toctree-l1"><a class="reference internal" href="../introduction/usergrid-features.html">Usergrid Features</a></li> +<li class="toctree-l1"><a class="reference internal" href="../introduction/data-model.html">Usergrid Data model</a></li> +<li class="toctree-l1"><a class="reference internal" href="../introduction/async-vs-sync.html">Async vs. sync calls</a></li> +</ul> +<p class="caption"><span class="caption-text">Getting Started</span></p> +<ul> +<li class="toctree-l1"><a class="reference internal" href="../getting-started/creating-a-new-application.html">Creating a new application</a></li> +<li class="toctree-l1"><a class="reference internal" href="../getting-started/creating-account.html">Creating an Usergrid Account</a></li> +<li class="toctree-l1"><a class="reference internal" href="../getting-started/using-a-sandbox-app.html">Using a Sandbox Application</a></li> +<li class="toctree-l1"><a class="reference internal" href="../getting-started/using-the-api.html">Using the API</a></li> +</ul> +<p class="caption"><span class="caption-text">Data Storage</span></p> +<ul> +<li class="toctree-l1"><a class="reference internal" href="../data-storage/data-store-dbms.html">The Usergrid Data Store</a></li> +<li class="toctree-l1"><a class="reference internal" href="../data-storage/optimizing-access.html">Data Store Best Practices</a></li> +<li class="toctree-l1"><a class="reference internal" href="../data-storage/collections.html">Collections</a></li> +<li class="toctree-l1"><a class="reference internal" href="../data-storage/entities.html">Entities</a></li> +</ul> +<p class="caption"><span class="caption-text">Data Queries</span></p> +<ul class="current"> +<li class="toctree-l1"><a class="reference internal" href="querying-your-data.html">Querying your data</a></li> +<li class="toctree-l1"><a class="reference internal" href="query-parameters.html">Query parameters & clauses</a></li> +<li class="toctree-l1"><a class="reference internal" href="operators-and-types.html">Query operators & data types</a></li> +<li class="toctree-l1 current"><a class="current reference internal" href="">Advanced query usage</a><ul> +<li class="toctree-l2"><a class="reference internal" href="#attaching-a-query-to-all-api-calls">Attaching a query to all API calls</a></li> +</ul> +</li> +</ul> +<p class="caption"><span class="caption-text">Entity Connections</span></p> +<ul> +<li class="toctree-l1"><a class="reference internal" href="../entity-connections/connecting-entities.html">Connecting entities</a></li> +<li class="toctree-l1"><a class="reference internal" href="../entity-connections/retrieving-entities.html">Retrieving connections</a></li> +<li class="toctree-l1"><a class="reference internal" href="../entity-connections/disconnecting-entities.html">Disconnecting entities</a></li> +</ul> +<p class="caption"><span class="caption-text">Security & Authentication</span></p> +<ul> +<li class="toctree-l1"><a class="reference internal" href="../security-and-auth/app-security.html">Security & token authentication</a></li> +<li class="toctree-l1"><a class="reference internal" href="../security-and-auth/using-permissions.html">Using permissions</a></li> +<li class="toctree-l1"><a class="reference internal" href="../security-and-auth/authenticating-users-and-application-clients.html">Authenticating users & app clients</a></li> +<li class="toctree-l1"><a class="reference internal" href="../security-and-auth/user-authentication-types.html">Authentication levels</a></li> +<li class="toctree-l1"><a class="reference internal" href="../security-and-auth/changing-token-time-live-ttl.html">Changing token expiration (time-to-live)</a></li> +<li class="toctree-l1"><a class="reference internal" href="../security-and-auth/authenticating-api-requests.html">Authenticating API requests</a></li> +<li class="toctree-l1"><a class="reference internal" href="../security-and-auth/revoking-tokens-logout.html">Revoking tokens (logout)</a></li> +<li class="toctree-l1"><a class="reference internal" href="../security-and-auth/facebook-sign.html">Facebook sign in</a></li> +<li class="toctree-l1"><a class="reference internal" href="../security-and-auth/securing-your-app.html">Security best practices</a></li> +</ul> +<p class="caption"><span class="caption-text">User Management & Social Graph</span></p> +<ul> +<li class="toctree-l1"><a class="reference internal" href="../user-management/user-management.html">User management & social graph</a></li> +<li class="toctree-l1"><a class="reference internal" href="../user-management/working-user-data.html">Working with User Data</a></li> +<li class="toctree-l1"><a class="reference internal" href="../user-management/group.html">Working with group data</a></li> +<li class="toctree-l1"><a class="reference internal" href="../user-management/activity.html">Activity</a></li> +<li class="toctree-l1"><a class="reference internal" href="../user-management/user-connections.html">Social Graph Connections</a></li> +<li class="toctree-l1"><a class="reference internal" href="../user-management/user-connections.html#creating-other-connections">Creating other connections</a></li> +<li class="toctree-l1"><a class="reference internal" href="../user-management/messagee-example.html">App Example - Messagee</a></li> +</ul> +<p class="caption"><span class="caption-text">Geo-location</span></p> +<ul> +<li class="toctree-l1"><a class="reference internal" href="../geolocation/geolocation.html">Geolocating your Entities</a></li> +</ul> +<p class="caption"><span class="caption-text">Assets & Files</span></p> +<ul> +<li class="toctree-l1"><a class="reference internal" href="../asset-and-files/uploading-assets.html">Uploading assets</a></li> +<li class="toctree-l1"><a class="reference internal" href="../asset-and-files/retrieving-assets.html">Retrieving assets</a></li> +<li class="toctree-l1"><a class="reference internal" href="../asset-and-files/folders.html">Folders</a></li> +</ul> +<p class="caption"><span class="caption-text">Counters & Events</span></p> +<ul> +<li class="toctree-l1"><a class="reference internal" href="../counters-and-events/events-and-counters.html">Counters & events</a></li> +<li class="toctree-l1"><a class="reference internal" href="../counters-and-events/creating-and-incrementing-counters.html">Creating & incrementing counters</a></li> +<li class="toctree-l1"><a class="reference internal" href="../counters-and-events/creating-and-incrementing-counters.html#decrementing-resetting-counters">Decrementing/resetting counters</a></li> +<li class="toctree-l1"><a class="reference internal" href="../counters-and-events/creating-and-incrementing-counters.html#using-counters-hierarchically">Using counters hierarchically</a></li> +<li class="toctree-l1"><a class="reference internal" href="../counters-and-events/retrieving-counters.html">Retrieving counters</a></li> +</ul> +<p class="caption"><span class="caption-text">Organizations & Applications</span></p> +<ul> +<li class="toctree-l1"><a class="reference internal" href="../orgs-and-apps/managing.html">Organization & application management</a></li> +<li class="toctree-l1"><a class="reference internal" href="../orgs-and-apps/organization.html">Organization</a></li> +<li class="toctree-l1"><a class="reference internal" href="../orgs-and-apps/application.html">Application</a></li> +</ul> +<p class="caption"><span class="caption-text">API Reference</span></p> +<ul> +<li class="toctree-l1"><a class="reference internal" href="../rest-endpoints/api-docs.html">Methods</a></li> +<li class="toctree-l1"><a class="reference internal" href="../rest-endpoints/api-docs.html#models">Models</a></li> +</ul> +<p class="caption"><span class="caption-text">Client SDKs</span></p> +<ul> +<li class="toctree-l1"><a class="reference internal" href="../sdks/tbd.html">COMING SOON...</a></li> +</ul> +<p class="caption"><span class="caption-text">Installing the Stack</span></p> +<ul> +<li class="toctree-l1"><a class="reference internal" href="../installation/ug1-deploy-to-tomcat.html">Usegrid 1: Deploying to Tomcat</a></li> +<li class="toctree-l1"><a class="reference internal" href="../installation/ug1-launcher-quick-start.html">Usegrid 1: Launcher Quick-start</a></li> +<li class="toctree-l1"><a class="reference internal" href="../installation/ug2-deploy-to-tomcat.html">Usergrid 2: Deploy to Tomcat</a></li> +</ul> +<p class="caption"><span class="caption-text">More about Usergrid</span></p> +<ul> +<li class="toctree-l1"><a class="reference internal" href="../reference/presos-and-videos.html">Presentations & Videos</a></li> +<li class="toctree-l1"><a class="reference internal" href="../reference/contribute-code.html">How to Contribute Code & Docs</a></li> +</ul> + + + + </div> + + </nav> + + <section data-toggle="wy-nav-shift" class="wy-nav-content-wrap"> + + + <nav class="wy-nav-top" role="navigation" aria-label="top navigation"> + <i data-toggle="wy-nav-top" class="fa fa-bars"></i> + <a href="../index.html">Apache Usergrid</a> + </nav> + + + + <div class="wy-nav-content"> + <div class="rst-content"> + <div role="navigation" aria-label="breadcrumbs navigation"> + <ul class="wy-breadcrumbs"> + <li><a href="../index.html">Docs</a> »</li> + + <li>Advanced query usage</li> + <li class="wy-breadcrumbs-aside"> + + + <a href="../_sources/data-queries/advanced-query-usage.txt" rel="nofollow"> View page source</a> + + + </li> + </ul> + <hr/> +</div> + <div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article"> + <div itemprop="articleBody"> + + <div class="section" id="advanced-query-usage"> +<h1>Advanced query usage<a class="headerlink" href="#advanced-query-usage" title="Permalink to this headline">¶</a></h1> +<div class="admonition note"> <p class="first admonition-title"><p>Note</p> + </p> <p class="last"> + + +Query examples in this content are shown unencoded to make them easier<p>to read. Keep in mind that you might need to encode query strings if +you’re sending them as part of URLs, such as when you’re executing them +with the cURL tool.</p> +</p></div><div class="section" id="attaching-a-query-to-all-api-calls"> +<h2>Attaching a query to all API calls<a class="headerlink" href="#attaching-a-query-to-all-api-calls" title="Permalink to this headline">¶</a></h2> +<div class="admonition note"> <p class="first admonition-title"><p>Note</p> +</p> <p class="last"><p><p>JavaScript SDK only.</p> +</p><p>In some cases, it may be convenient to attach a query or other URI +parameter to every call you make to Usergrid, such as a custom +identifier or token. To do this with the Usergrid JavaScript SDK, add a +qs property to your Usergrid.Client object when you initialize the SDK. +For more on initializing the SDK, see our install guide.</p> +</p></div><p>For example, the following would append ?custom_id=1234 to every call +sent from the Usergrid JavaScript SDK to Usergrid:</p> +<div class="highlight-python"><div class="highlight"><pre>var options = { + orgName:'yourOrg', + appName:'yourApp', + qs:'custom_id=1234' +} +var dataClient = new Usergrid.Client(options); +</pre></div> +</div> +</div> +</div> + + + </div> + </div> + <footer> + + <div class="rst-footer-buttons" role="navigation" aria-label="footer navigation"> + + <a href="../entity-connections/connecting-entities.html" class="btn btn-neutral float-right" title="Connecting entities" accesskey="n">Next <span class="fa fa-arrow-circle-right"></span></a> + + + <a href="operators-and-types.html" class="btn btn-neutral" title="Query operators & data types" accesskey="p"><span class="fa fa-arrow-circle-left"></span> Previous</a> + + </div> + + + <hr/> + + <div role="contentinfo"> + <p> + © Copyright 2013-2015, Apache Usergrid. + + </p> + </div> + Built with <a href="http://sphinx-doc.org/">Sphinx</a> using a <a href="https://github.com/snide/sphinx_rtd_theme">theme</a> provided by <a href="https://readthedocs.org">Read the Docs</a>. + +</footer> + + </div> + </div> + + </section> + + </div> + + + + + + <script type="text/javascript"> + var DOCUMENTATION_OPTIONS = { + URL_ROOT:'../', + VERSION:'1.0', + COLLAPSE_INDEX:false, + FILE_SUFFIX:'.html', + HAS_SOURCE: true + }; + </script> + <script type="text/javascript" src="../_static/jquery.js"></script> + <script type="text/javascript" src="../_static/underscore.js"></script> + <script type="text/javascript" src="../_static/doctools.js"></script> + + + + + + <script type="text/javascript" src="../_static/js/theme.js"></script> + + + + + <script type="text/javascript"> + jQuery(function () { + SphinxRtdTheme.StickyNav.enable(); + }); + </script> + + +</body> +</html> \ No newline at end of file