| |
| |
| <!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>Activity — Apache Usergrid 2.x documentation</title> |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| <link rel="stylesheet" href="../_static/css/theme.css" type="text/css" /> |
| |
| |
| |
| |
| |
| <link rel="top" title="Apache Usergrid 2.x documentation" href="../index.html"/> |
| <link rel="next" title="Social Graph Connections" href="user-connections.html"/> |
| <link rel="prev" title="Working with group data" href="group.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"> |
| 2.x |
| </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">Getting Started</span></p> |
| <ul> |
| <li class="toctree-l1"><a class="reference internal" href="../introduction/overview.html">Getting Started</a></li> |
| <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">Using Usergrid</span></p> |
| <ul> |
| <li class="toctree-l1"><a class="reference internal" href="../using-usergrid/creating-account.html">Creating a Usergrid Account</a></li> |
| <li class="toctree-l1"><a class="reference internal" href="../using-usergrid/creating-a-new-application.html">Creating a new application</a></li> |
| <li class="toctree-l1"><a class="reference internal" href="../using-usergrid/using-a-sandbox-app.html">Using a Sandbox Application</a></li> |
| <li class="toctree-l1"><a class="reference internal" href="../using-usergrid/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">Push Notifications</span></p> |
| <ul> |
| <li class="toctree-l1"><a class="reference internal" href="../push-notifications/overview.html">Push notifications overview</a></li> |
| <li class="toctree-l1"><a class="reference internal" href="../push-notifications/adding-push-support.html">Adding push notifications support</a></li> |
| <li class="toctree-l1"><a class="reference internal" href="../push-notifications/getting-started.html">Getting started with push notifications</a></li> |
| <li class="toctree-l1"><a class="reference internal" href="../push-notifications/tutorial.html">Tutorial: Push notifications sample app</a></li> |
| <li class="toctree-l1"><a class="reference internal" href="../push-notifications/registering.html">Registering with a notification service</a></li> |
| <li class="toctree-l1"><a class="reference internal" href="../push-notifications/creating-notifiers.html">Creating notifiers</a></li> |
| <li class="toctree-l1"><a class="reference internal" href="../push-notifications/managing-users-and-devices.html">Managing users and devices</a></li> |
| <li class="toctree-l1"><a class="reference internal" href="../push-notifications/creating-and-managing-notifications.html">Creating and managing notifications</a></li> |
| <li class="toctree-l1"><a class="reference internal" href="../push-notifications/troubleshooting.html">Troubleshooting</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/using-roles.html">Using roles</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 class="current"> |
| <li class="toctree-l1"><a class="reference internal" href="user-management.html">User management & social graph</a></li> |
| <li class="toctree-l1"><a class="reference internal" href="working-user-data.html">Working with User Data</a></li> |
| <li class="toctree-l1"><a class="reference internal" href="group.html">Working with group data</a></li> |
| <li class="toctree-l1 current"><a class="current reference internal" href="">Activity</a><ul> |
| <li class="toctree-l2"><a class="reference internal" href="#posting-activities">Posting activities</a><ul> |
| <li class="toctree-l3"><a class="reference internal" href="#request-uri">Request URI</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="#example-request">Example - Request</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="#example-response">Example - Response</a></li> |
| </ul> |
| </li> |
| <li class="toctree-l2"><a class="reference internal" href="#posting-an-activity-to-a-group">Posting an activity to a group</a><ul> |
| <li class="toctree-l3"><a class="reference internal" href="#id1">Request URI</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="#id2">Example - Request</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="#id3">Example - Response</a></li> |
| </ul> |
| </li> |
| <li class="toctree-l2"><a class="reference internal" href="#creating-an-activity-for-a-user-s-followers-in-a-group">Creating an activity for a user’s followers in a group</a><ul> |
| <li class="toctree-l3"><a class="reference internal" href="#id4">Request URI</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="#id5">Example - Request</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="#id6">Example - Response</a></li> |
| </ul> |
| </li> |
| <li class="toctree-l2"><a class="reference internal" href="#retrieving-activity-feeds">Retrieving activity feeds</a><ul> |
| <li class="toctree-l3"><a class="reference internal" href="#id7">Request URI</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="#id8">Example - Request</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="#id9">Example - Response</a></li> |
| </ul> |
| </li> |
| <li class="toctree-l2"><a class="reference internal" href="#retrieving-a-group-s-activity-feed">Retrieving a group’s activity feed</a><ul> |
| <li class="toctree-l3"><a class="reference internal" href="#id10">Request URI</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="#id11">Example - Request</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="#id12">Example - Response</a></li> |
| </ul> |
| </li> |
| </ul> |
| </li> |
| <li class="toctree-l1"><a class="reference internal" href="user-connections.html">Social Graph Connections</a></li> |
| <li class="toctree-l1"><a class="reference internal" href="user-connections.html#creating-other-connections">Creating other connections</a></li> |
| <li class="toctree-l1"><a class="reference internal" href="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="../assets-and-files/uploading-assets.html">Uploading assets</a></li> |
| <li class="toctree-l1"><a class="reference internal" href="../assets-and-files/retrieving-assets.html">Retrieving assets</a></li> |
| <li class="toctree-l1"><a class="reference internal" href="../assets-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> |
| <li class="toctree-l1"><a class="reference internal" href="../orgs-and-apps/admin-user.html">Admin user</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> |
| <li class="toctree-l1"><a class="reference internal" href="../rest-endpoints/api-docs.html#sub-types">Sub-Types</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 Usergrid</span></p> |
| <ul> |
| <li class="toctree-l1"><a class="reference internal" href="../installation/deployment-guide.html">Usergrid 2.1.0 Deployment Guide</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>Activity</li> |
| <li class="wy-breadcrumbs-aside"> |
| |
| |
| <a href="../_sources/user-management/activity.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="activity"> |
| <h1>Activity<a class="headerlink" href="#activity" title="Permalink to this headline">¶</a></h1> |
| <p>Most modern applications struggle to manage data streams, such as those |
| that contain an ongoing list of comments, activities, and tweets. In |
| particular, mobile applications are prone to generating very large |
| amounts of data in a data stream. Beyond that, additions to a data |
| stream must often be routed automatically to subscribers or filtered or |
| counted.</p> |
| <p>Usergrid provides an activity entity that is specifically designed for |
| data streams. An activity is an entity type that represents activity |
| stream actions (see the <a class="reference external" href="http://activitystrea.ms/specs/json/1.0/">JSON Activity Streams 1.0 |
| specification</a> for more |
| information about these actions).</p> |
| <p>When a user creates an activity, it creates a relationship between the |
| activity and the user who created it. Because this relationship exists, |
| the activity will appear in the feed of any of the user’s followers. |
| Think of the Activities endpoint (<code class="docutils literal"><span class="pre">/users/{uuid|username}/activities</span></code>) |
| as an “outbox” of news items created by the user. Think of the Feed |
| endpoint (<code class="docutils literal"><span class="pre">/users/{uuid|username}/feed</span></code>) as an “inbox” of news items |
| meant to be seen or consumed by the user.</p> |
| <p>A user can also post an activity to a group (located at |
| <code class="docutils literal"><span class="pre">/groups/{uuid|groupname}/activities</span></code>). This allows you to emulate |
| Facebook-style group functionality, where a limited number of users can |
| share content on a common “wall”. In any of these cases, there is no |
| need to construct publish/subscribe relationships manually.</p> |
| <p>Activity entities are particularly useful in applications that enable |
| users to post content to activity streams (also called feeds) and to |
| display activity streams. Some examples of these applications are |
| Twitter, foursquare, and Pinterest. For example, when a Twitter user |
| posts a short, 140-character or less, “tweet”, that activity gets added |
| to the user’s activity stream for display as well as to the activity |
| streams of any of the user’s followers.</p> |
| <p>Using Usergrid APIs you can create, retrieve, update, and delete |
| activity entities.</p> |
| <p><strong>Note:</strong> Although not shown in the API examples below, you need to |
| provide a valid access token with each API call. See <a class="reference external" href="../security-and-auth/authenticating-users-and-application-clients.html">Authenticating |
| users and application |
| clients</a> |
| for details.</p> |
| <div class="section" id="posting-activities"> |
| <h2>Posting activities<a class="headerlink" href="#posting-activities" title="Permalink to this headline">¶</a></h2> |
| <p>Posting a user activity</p> |
| <p>Use the POST method to create an activity in the activities collection.</p> |
| <div class="section" id="request-uri"> |
| <h3>Request URI<a class="headerlink" href="#request-uri" title="Permalink to this headline">¶</a></h3> |
| <div class="highlight-python"><div class="highlight"><pre>POST /<org_id>/<app_id>/users/<uuid | username>/activities { request body } |
| </pre></div> |
| </div> |
| <p>Parameters</p> |
| <table border="1" class="docutils"> |
| <colgroup> |
| <col width="39%" /> |
| <col width="61%" /> |
| </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>arg uuid|string org_id</td> |
| <td>Organization UUID or organization name</td> |
| </tr> |
| <tr class="row-odd"><td>arg uuid|string app_id</td> |
| <td>Application UUID or application name</td> |
| </tr> |
| <tr class="row-even"><td>request body</td> |
| <td>One or more sets of activity properties</td> |
| </tr> |
| </tbody> |
| </table> |
| <p>Here’s an example request body:</p> |
| <div class="highlight-python"><div class="highlight"><pre>{ |
| "actor":{ |
| "displayName":"John Doe", |
| "uuid":"1f3567aa-da83-11e1-afad-12313b01d5c1", |
| "username":"john.doe", |
| "image":{ |
| "duration":0, |
| "height":80, |
| "url":"http://www.gravatar.com/avatar/","width":80}, |
| "email":"john.doe@gmail.com" |
| }, |
| "verb":"post", |
| "content":"Hello World!" |
| } |
| } |
| </pre></div> |
| </div> |
| </div> |
| <div class="section" id="example-request"> |
| <h3>Example - Request<a class="headerlink" href="#example-request" title="Permalink to this headline">¶</a></h3> |
| <div class="highlight-python"><div class="highlight"><pre>curl -X POST "https://api.usergrid.com/my-org/my-app/users/john.doe/activities" -d '{"actor":{"displayName":"John Doe","uuid":"1f3567aa-da83-11e1-afad-12313b01d5c1","username":"john.doe", "image":{"duration":0,"height":80,"url":"http://www.gravatar.com/avatar/","width":80}, "email":"john.doe@gmail.com"},"verb":"post","content":"Hello World!"}' |
| </pre></div> |
| </div> |
| </div> |
| <div class="section" id="example-response"> |
| <h3>Example - Response<a class="headerlink" href="#example-response" title="Permalink to this headline">¶</a></h3> |
| <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">"5111c463-6a42-11e1-b6dd-1231380a0284"</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">"/users/1f3567aa-da83-11e1-afad-12313b01d5c1/activities"</span><span class="p">,</span> |
| <span class="s">"uri"</span> <span class="p">:</span> <span class="s">"https://api.usergrid.com/5111c463-6a42-11e1-b6dd-1231380a0284/users/1f3567aa-da83-11e1-afad-12313b01d5c1/activities"</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">"da448955-f3aa-11e1-8042-12313d331ae8"</span><span class="p">,</span> |
| <span class="s">"type"</span> <span class="p">:</span> <span class="s">"activity"</span><span class="p">,</span> |
| <span class="s">"created"</span> <span class="p">:</span> <span class="mi">1346445092974</span><span class="p">,</span> |
| <span class="s">"modified"</span> <span class="p">:</span> <span class="mi">1346445092974</span><span class="p">,</span> |
| <span class="s">"actor"</span> <span class="p">:</span> <span class="p">{</span> |
| <span class="s">"displayName"</span> <span class="p">:</span> <span class="s">"John Doe"</span><span class="p">,</span> |
| <span class="s">"uuid"</span> <span class="p">:</span> <span class="s">"1f3567aa-da83-11e1-afad-12313b01d5c1"</span><span class="p">,</span> |
| <span class="s">"username"</span> <span class="p">:</span> <span class="s">"john.doe"</span><span class="p">,</span> |
| <span class="s">"image"</span> <span class="p">:</span> <span class="p">{</span> |
| <span class="s">"duration"</span> <span class="p">:</span> <span class="mi">0</span><span class="p">,</span> |
| <span class="s">"height"</span> <span class="p">:</span> <span class="mi">80</span><span class="p">,</span> |
| <span class="s">"url"</span> <span class="p">:</span> <span class="s">"http://www.gravatar.com/avatar/"</span><span class="p">,</span> |
| <span class="s">"width"</span> <span class="p">:</span> <span class="mi">80</span> |
| <span class="p">},</span> |
| <span class="s">"email"</span> <span class="p">:</span> <span class="s">"john.doe@gmail.com"</span> |
| <span class="p">},</span> |
| <span class="s">"content"</span> <span class="p">:</span> <span class="s">"Hello World!"</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">"/users/1f3567aa-da83-11e1-afad-12313b01d5c1/activities/da448955-f3aa-11e1-8042-12313d331ae8"</span> |
| <span class="p">},</span> |
| <span class="s">"published"</span> <span class="p">:</span> <span class="mi">1346445092974</span><span class="p">,</span> |
| <span class="s">"verb"</span> <span class="p">:</span> <span class="s">"post"</span> |
| <span class="p">}</span> <span class="p">],</span> |
| <span class="s">"timestamp"</span> <span class="p">:</span> <span class="mi">1346445092827</span><span class="p">,</span> |
| <span class="s">"duration"</span> <span class="p">:</span> <span class="mi">1406</span><span class="p">,</span> |
| <span class="s">"organization"</span><span class="p">:</span> <span class="s">"my-org"</span><span class="p">,</span> |
| <span class="s">"applicationName"</span><span class="p">:</span> <span class="s">"my-app"</span> |
| <span class="p">}</span> |
| </pre></div> |
| </div> |
| <p><strong>Note</strong>: Anytime a logged-in user makes a request, you can substitute |
| “me” for the uuid or username. So the format of a request to create an |
| activity for the currently logged-in user would look like this:</p> |
| <div class="highlight-python"><div class="highlight"><pre>POST /<org_id>/<app_id>/users/me/activities { request body } |
| </pre></div> |
| </div> |
| <p>The <code class="docutils literal"><span class="pre">/users/me</span></code> endpoint is accessible only if you provide an access |
| token with the request. If you don’t provide an access token with the |
| request, that is, you make an anonymous (or “guest”) call, the system |
| will not be able to determine which user to return as <code class="docutils literal"><span class="pre">/users/me</span></code>.</p> |
| <p>When you create an activity it creates a relationship between the |
| activity and the user who created it. In other words, the newly created |
| activity above belongs to john.doe. Another way of saying this is the |
| user “owns” the activity. And because this relationship exists, the |
| activity will appear in the feed of any of the user’s followers (in this |
| example, anyone who is following john.doe). However, it will not appear |
| in the feed of people the user follows. The activity is accessible at |
| the <code class="docutils literal"><span class="pre">/activities</span></code> endpoint to users who have the permission to read |
| that endpoint.</p> |
| <p>Notice the properties specified in the request body in the previous |
| example are actor, verb, and content. The actor, verb, and content |
| properties are built into the Activity entity (see <a class="reference external" href="../rest-endpoints/api-doc.html#activity">Activity entity |
| properties</a> ). The actor |
| property specifies properties of the entity that performs the action |
| (here, user john.doe). The gravatar URL is used to create an icon for |
| the activity. And because an Activity is simply an API Services data |
| entity, you can also create custom properties.</p> |
| <p>The verb parameter is descriptive. You can use it to indicate what type |
| of activity is posted, for example, an image versus text. The value post |
| is defined in the JSON Activity Streams specification as “the act of |
| authoring an object and then publishing it online.“</p> |
| </div> |
| </div> |
| <div class="section" id="posting-an-activity-to-a-group"> |
| <h2>Posting an activity to a group<a class="headerlink" href="#posting-an-activity-to-a-group" title="Permalink to this headline">¶</a></h2> |
| <p>Use the POST method to post an activity to a specific group. In this |
| case the activity is created in the activities collection and is |
| accessible at the <code class="docutils literal"><span class="pre">/activities</span></code> endpoint to users who have the |
| permission to read that endpoint. In addition, a relationship is |
| established between the activity and the group, and because of that, the |
| activity will appear in the group’s feed. The group “owns” the activity. |
| Also, the activity will be published in the feed of all users that are |
| members of the group.</p> |
| <div class="section" id="id1"> |
| <h3>Request URI<a class="headerlink" href="#id1" title="Permalink to this headline">¶</a></h3> |
| <div class="highlight-python"><div class="highlight"><pre>POST /{org_id}/{app_id}/groups/{uuid|groupname}/activities {request body} |
| </pre></div> |
| </div> |
| <p>Parameters</p> |
| <table border="1" class="docutils"> |
| <colgroup> |
| <col width="41%" /> |
| <col width="59%" /> |
| </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>arg uuid|string org_id</td> |
| <td>Organization UUID or organization name</td> |
| </tr> |
| <tr class="row-odd"><td>arg uuid|string app_id</td> |
| <td>Application UUID or application name</td> |
| </tr> |
| <tr class="row-even"><td>arg uuid|string groupname</td> |
| <td>UUID or name of the group</td> |
| </tr> |
| <tr class="row-odd"><td>request body</td> |
| <td>One or more sets of activity properties.</td> |
| </tr> |
| </tbody> |
| </table> |
| <p>Here’s a sample request body:</p> |
| <div class="highlight-python"><div class="highlight"><pre><span class="p">{</span> |
| <span class="s">"actor"</span><span class="p">:</span> |
| <span class="p">{</span> |
| <span class="s">"displayName"</span><span class="p">:</span><span class="s">"John Doe"</span><span class="p">,</span> |
| <span class="s">"uuid"</span><span class="p">:</span><span class="s">"1f3567aa-da83-11e1-afad-12313b01d5c1"</span><span class="p">,</span> |
| <span class="s">"username"</span><span class="p">:</span><span class="s">"john.doe"</span><span class="p">,</span> |
| <span class="s">"image"</span><span class="p">:{</span> |
| <span class="s">"duration"</span><span class="p">:</span><span class="mi">0</span><span class="p">,</span> |
| <span class="s">"height"</span><span class="p">:</span><span class="mi">80</span><span class="p">,</span> |
| <span class="s">"url"</span><span class="p">:</span><span class="s">"http://www.gravatar.com/avatar/"</span><span class="p">,</span><span class="s">"width"</span><span class="p">:</span><span class="mi">80</span><span class="p">},</span> |
| <span class="s">"email"</span><span class="p">:</span><span class="s">"john.doe@gmail.com"</span><span class="p">},</span> |
| <span class="s">"verb"</span><span class="p">:</span><span class="s">"post"</span><span class="p">,</span> |
| <span class="s">"content"</span><span class="p">:</span><span class="s">"Hello World!"</span> |
| <span class="p">}</span> |
| </pre></div> |
| </div> |
| </div> |
| <div class="section" id="id2"> |
| <h3>Example - Request<a class="headerlink" href="#id2" title="Permalink to this headline">¶</a></h3> |
| <div class="highlight-python"><div class="highlight"><pre>curl -X POST "https://api.usergrid.com/my-org/my-app/groups/mygroup/activities" -d '{"actor":{"displayName":"John Doe","uuid":"1f3567aa-da83-11e1-afad-12313b01d5c1","username":"john.doe", "image":{"duration":0,"height":80,"url":"http://www.gravatar.com/avatar/","width":80}, "email":"john.doe@gmail.com"},"verb":"post","content":"Hello World!"}' |
| </pre></div> |
| </div> |
| <p>Because this relationship exists, this activity will appear in the feed |
| of all users who are members of mygroup. It won’t appear in the feeds of |
| the group members’ followers or in feeds of users they follow.</p> |
| </div> |
| <div class="section" id="id3"> |
| <h3>Example - Response<a class="headerlink" href="#id3" title="Permalink to this headline">¶</a></h3> |
| <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">"3400ba10-cd0c-11e1-bcf7-12313d1c4491"</span><span class="p">,</span> |
| <span class="s">"params"</span><span class="p">:</span> <span class="p">{},</span> |
| <span class="s">"path"</span><span class="p">:</span> <span class="s">"/groups/d87edec7-fc4d-11e1-9917-12313d1520f1/activities"</span><span class="p">,</span> |
| <span class="s">"uri"</span><span class="p">:</span> <span class="s">"https://api.usergrid.com/my-org/my-app/groups/d87edec7-fc4d-11e1-9917-12313d1520f1/activities"</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">"563f5d96-37f3-11e2-a0f7-02e81ae640dc"</span><span class="p">,</span> |
| <span class="s">"type"</span><span class="p">:</span> <span class="s">"activity"</span><span class="p">,</span> |
| <span class="s">"created"</span><span class="p">:</span> <span class="mi">1353952903811</span><span class="p">,</span> |
| <span class="s">"modified"</span><span class="p">:</span> <span class="mi">1353952903811</span><span class="p">,</span> |
| <span class="s">"actor"</span><span class="p">:</span> <span class="p">{</span> |
| <span class="s">"displayName"</span><span class="p">:</span> <span class="s">"John Doe"</span><span class="p">,</span> |
| <span class="s">"uuid"</span><span class="p">:</span> <span class="s">"1f3567aa-da83-11e1-afad-12313b01d5c1"</span><span class="p">,</span> |
| <span class="s">"username"</span><span class="p">:</span> <span class="s">"john.doe"</span><span class="p">,</span> |
| <span class="s">"image"</span><span class="p">:</span> <span class="p">{</span> |
| <span class="s">"duration"</span><span class="p">:</span> <span class="mi">0</span><span class="p">,</span> |
| <span class="s">"height"</span><span class="p">:</span> <span class="mi">80</span><span class="p">,</span> |
| <span class="s">"url"</span><span class="p">:</span> <span class="s">"http://www.gravatar.com/avatar/"</span><span class="p">,</span> |
| <span class="s">"width"</span><span class="p">:</span> <span class="mi">80</span> |
| <span class="p">},</span> |
| <span class="s">"email"</span><span class="p">:</span> <span class="s">"john.doe@gmail.com"</span> |
| <span class="p">},</span> |
| <span class="s">"content"</span><span class="p">:</span> <span class="s">"Hello World!"</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">"/groups/d87edec7-fc4d-11e1-9917-12313d1520f1/activities/563f5d96-37f3-11e2-a0f7-02e81ae640dc"</span> |
| <span class="p">},</span> |
| <span class="s">"published"</span><span class="p">:</span> <span class="mi">1353952903811</span><span class="p">,</span> |
| <span class="s">"verb"</span><span class="p">:</span> <span class="s">"post"</span> |
| <span class="p">}</span> |
| <span class="p">],</span> |
| <span class="s">"timestamp"</span><span class="p">:</span> <span class="mi">1353952903800</span><span class="p">,</span> |
| <span class="s">"duration"</span><span class="p">:</span> <span class="mi">81</span><span class="p">,</span> |
| <span class="s">"organization"</span><span class="p">:</span> <span class="s">"my-org"</span><span class="p">,</span> |
| <span class="s">"applicationName"</span><span class="p">:</span> <span class="s">"my-app"</span> |
| <span class="p">}</span> |
| </pre></div> |
| </div> |
| </div> |
| </div> |
| <div class="section" id="creating-an-activity-for-a-user-s-followers-in-a-group"> |
| <h2>Creating an activity for a user’s followers in a group<a class="headerlink" href="#creating-an-activity-for-a-user-s-followers-in-a-group" title="Permalink to this headline">¶</a></h2> |
| <p>Use the POST method to create an activity that will be published only in |
| the feeds of users who (1) follow you, and (2) are in the same group to |
| which you posted the activity. This is useful if you want to create |
| specific groups of friends (for example, acquaintances or colleagues) |
| and publish content to them with more precise privacy settings. This |
| allows you to re-create a privacy model similar to Google+’s Circles or |
| Facebook current privacy system.</p> |
| <p>When you create an activity for a user’s followers in a group:</p> |
| <p>The activity is accessible at the <code class="docutils literal"><span class="pre">/activities</span></code> endpoint to users who |
| have the permission to read that endpoint. The activity will not be |
| cross-posted to the group’s activity endpoint |
| (<code class="docutils literal"><span class="pre">/groups/{uuid|groupname}/activities</span></code>) A relationship is |
| automatically created between the activity entity that was just created |
| and the user within that group |
| (<code class="docutils literal"><span class="pre">/groups/{uuid|groupname}/users/{uuid|username}</span></code>) The user within the |
| group (<code class="docutils literal"><span class="pre">/groups/{uuid|groupname}/users/{uuid|username}</span></code>) becomes the |
| owner of the activity (through the owner property in the activity).</p> |
| <div class="section" id="id4"> |
| <h3>Request URI<a class="headerlink" href="#id4" title="Permalink to this headline">¶</a></h3> |
| <div class="highlight-python"><div class="highlight"><pre>POST /{org_id}/{app_id}/groups/{uuid|groupname}/users/{uuid|username}/activities {request body} |
| </pre></div> |
| </div> |
| <p>Parameters</p> |
| <p>Parameter Description arg uuid|string org_id Organization UUID or |
| organization name arg uuid|string app_id Application UUID or |
| application name arg uuid|string groupname UUID or name of the group |
| arg uuid|string username UUID or name of the user request body One or |
| more sets of activity properties</p> |
| <p>Example request body:</p> |
| <div class="highlight-python"><div class="highlight"><pre><span class="p">{</span> |
| <span class="s">"actor"</span><span class="p">:</span> |
| <span class="p">{</span> |
| <span class="s">"displayName"</span><span class="p">:</span><span class="s">"John Doe"</span><span class="p">,</span> |
| <span class="s">"uuid"</span><span class="p">:</span><span class="s">"1f3567aa-da83-11e1-afad-12313b01d5c1"</span><span class="p">,</span> |
| <span class="s">"username"</span><span class="p">:</span><span class="s">"john.doe"</span><span class="p">,</span> |
| <span class="s">"image"</span><span class="p">:{</span> |
| <span class="s">"duration"</span><span class="p">:</span><span class="mi">0</span><span class="p">,</span> |
| <span class="s">"height"</span><span class="p">:</span><span class="mi">80</span><span class="p">,</span> |
| <span class="s">"url"</span><span class="p">:</span><span class="s">"http://www.gravatar.com/avatar/"</span><span class="p">,</span><span class="s">"width"</span><span class="p">:</span><span class="mi">80</span><span class="p">},</span> |
| <span class="s">"email"</span><span class="p">:</span><span class="s">"john.doe@gmail.com"</span><span class="p">},</span> |
| <span class="s">"verb"</span><span class="p">:</span><span class="s">"post"</span><span class="p">,</span> |
| <span class="s">"content"</span><span class="p">:</span><span class="s">"Hello World!"</span> |
| <span class="p">}</span> |
| </pre></div> |
| </div> |
| </div> |
| <div class="section" id="id5"> |
| <h3>Example - Request<a class="headerlink" href="#id5" title="Permalink to this headline">¶</a></h3> |
| <div class="highlight-python"><div class="highlight"><pre>curl -X POST "https://api.usergrid.com/my-org/my-app/groups/mygroup/users/john.doe/activities" -d '{"actor":{"displayName":"John Doe","uuid":"1f3567aa-da83-11e1-afad-12313b01d5c1","username":"john.doe", "image":{"duration":0,"height":80,"url":"http://www.gravatar.com/avatar/","width":80}, "email":"john.doe@gmail.com"},"verb":"post","content":"Hello World!"}' |
| </pre></div> |
| </div> |
| <p>Because this relationship exists, this activity will appear in the feed |
| of all users who are members of mygroup. It won’t appear in the feeds of |
| the group members’ followers or in feeds of users they follow.</p> |
| </div> |
| <div class="section" id="id6"> |
| <h3>Example - Response<a class="headerlink" href="#id6" title="Permalink to this headline">¶</a></h3> |
| <div class="highlight-python"><div class="highlight"><pre>{ |
| "action" : "post", |
| "application" : "3400ba10-cd0c-11e1-bcf7-12313d1c4491", |
| "params" : { }, |
| "path" : "/groups/d87edec7-fc4d-11e1-9917-12313d1520f1/users/34e26bc9-2d00-11e2-a065-02e81ae640dc/activities", |
| "uri" : "https://api.usergrid.com/my-org/my-app/ |
| /groups/d87edec7-fc4d-11e1-9917-12313d1520f1/users/34e26bc9-2d00-11e2-a065-02e81ae640dc/activities", |
| "entities" : [ { |
| "uuid" : "2440ca58-49ff-11e2-84c0-02e81adcf3d0", |
| "type" : "activity", |
| "created" : 1355937094825, |
| "modified" : 1355937094825, |
| "actor" : { |
| "displayName" : "John Doe", |
| "uuid" : "1f3567aa-da83-11e1-afad-12313b01d5c1", |
| "username" : "john.doe", |
| "image" : { |
| "duration" : 0, |
| "height" : 80, |
| "url" : "http://www.gravatar.com/avatar/", |
| "width" : 80 |
| }, |
| "email" : "john.doe@gmail.com" |
| }, |
| "content" : "Happy New Year!", |
| "metadata" : { |
| "path" : "/groups/d87edec7-fc4d-11e1-9917-12313d1520f1/users/34e26bc9-2d00-11e2-a065-02e81ae640dc/activities/2440ca58-49ff-11e2-84c0-02e81adcf3d0" |
| }, |
| "published" : 1355937094825, |
| "verb" : "post" |
| } ], |
| "timestamp" : 1355937094789, |
| "duration" : 95, |
| "organization" : "my-org", |
| "applicationName" : "my-app" |
| } |
| </pre></div> |
| </div> |
| </div> |
| </div> |
| <div class="section" id="retrieving-activity-feeds"> |
| <h2>Retrieving activity feeds<a class="headerlink" href="#retrieving-activity-feeds" title="Permalink to this headline">¶</a></h2> |
| <p>Retrieving a user’s activity feed</p> |
| <p>Use the GET method to retrieve a user’s feed.</p> |
| <div class="section" id="id7"> |
| <h3>Request URI<a class="headerlink" href="#id7" title="Permalink to this headline">¶</a></h3> |
| <div class="highlight-python"><div class="highlight"><pre><span class="n">GET</span> <span class="o">/</span><span class="p">{</span><span class="n">org_id</span><span class="p">}</span><span class="o">/</span><span class="p">{</span><span class="n">app_id</span><span class="p">}</span><span class="o">/</span><span class="n">users</span><span class="o">/</span><span class="p">{</span><span class="n">uuid</span><span class="o">|</span><span class="n">username</span><span class="p">}</span><span class="o">/</span><span class="n">feed</span> |
| </pre></div> |
| </div> |
| </div> |
| <div class="section" id="id8"> |
| <h3>Example - Request<a class="headerlink" href="#id8" title="Permalink to this headline">¶</a></h3> |
| <div class="highlight-python"><div class="highlight"><pre>curl -X GET "https://api.usergrid.com/my-org/my-app/users/john.doe/feed" |
| </pre></div> |
| </div> |
| </div> |
| <div class="section" id="id9"> |
| <h3>Example - Response<a class="headerlink" href="#id9" title="Permalink to this headline">¶</a></h3> |
| <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">"3400ba10-cd0c-11e1-bcf7-12313d1c44914"</span><span class="p">,</span> |
| <span class="s">"params"</span> <span class="p">:</span> <span class="p">{},</span> |
| <span class="s">"path"</span> <span class="p">:</span> <span class="s">"/users/d9693ec3-61c9-11e2-9ffc-02e81adcf3d0/feed"</span><span class="p">,</span> |
| <span class="s">"uri"</span> <span class="p">:</span> <span class="s">"https://api.usergrid.com/3400ba10-cd0c-11e1-bcf7-12313d1c44914/users/d9693ec3-61c9-11e2-9ffc-02e81adcf3d0/feed"</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">"ffd79647-f399-11e1-aec3-12313b06ae01"</span><span class="p">,</span> |
| <span class="s">"type"</span> <span class="p">:</span> <span class="s">"activity"</span><span class="p">,</span> |
| <span class="s">"created"</span> <span class="p">:</span> <span class="mi">1346437854569</span><span class="p">,</span> |
| <span class="s">"modified"</span> <span class="p">:</span> <span class="mi">1346437854569</span><span class="p">,</span> |
| <span class="s">"actor"</span> <span class="p">:</span> <span class="p">{</span> |
| <span class="s">"displayName"</span> <span class="p">:</span> <span class="s">"John Doe"</span><span class="p">,</span> |
| <span class="s">"image"</span> <span class="p">:</span> <span class="p">{</span> |
| <span class="s">"duration"</span> <span class="p">:</span> <span class="mi">0</span><span class="p">,</span> |
| <span class="s">"height"</span> <span class="p">:</span> <span class="mi">80</span><span class="p">,</span> |
| <span class="s">"url"</span> <span class="p">:</span> <span class="s">"http://www.gravatar.com/avatar/"</span><span class="p">,</span> |
| <span class="s">"width"</span> <span class="p">:</span> <span class="mi">80</span> |
| <span class="p">},</span> |
| <span class="s">"uuid"</span> <span class="p">:</span> <span class="s">"d9693ec3-61c9-11e2-9ffc-02e81adcf3d0"</span><span class="p">,</span> |
| <span class="s">"email"</span> <span class="p">:</span> <span class="s">"john.doe@gmail.com"</span><span class="p">,</span> |
| <span class="s">"username"</span> <span class="p">:</span> <span class="s">"john.doe"</span> |
| <span class="p">},</span> |
| <span class="s">"content"</span> <span class="p">:</span> <span class="s">"Hello World!"</span><span class="p">,</span> |
| <span class="s">"metadata"</span> <span class="p">:</span> <span class="p">{</span> |
| <span class="s">"cursor"</span> <span class="p">:</span> <span class="s">"gGkAAQMAgGkABgE5ffM1aQCAdQAQ_9eWR_OZEeGuwxIxOwauAQCAdQAQABlaOvOaEeGuwxIxOwauAQA"</span><span class="p">,</span> |
| <span class="s">"path"</span> <span class="p">:</span> <span class="s">"/users/d9693ec3-61c9-11e2-9ffc-02e81adcf3d0/feed/ffd79647-f399-11e1-aec3-12313b06ae01"</span> |
| <span class="p">},</span> |
| <span class="s">"published"</span> <span class="p">:</span> <span class="mi">1346437854569</span><span class="p">,</span> |
| <span class="s">"verb"</span> <span class="p">:</span> <span class="s">"post"</span> |
| <span class="p">},</span> <span class="p">{</span> |
| <span class="s">"uuid"</span> <span class="p">:</span> <span class="s">"2482a1c5-e7d0-11e1-96f6-12313b06d112"</span><span class="p">,</span> |
| <span class="s">"type"</span> <span class="p">:</span> <span class="s">"activity"</span><span class="p">,</span> |
| <span class="s">"created"</span> <span class="p">:</span> <span class="mi">1345141694958</span><span class="p">,</span> |
| <span class="s">"modified"</span> <span class="p">:</span> <span class="mi">1345141694958</span><span class="p">,</span> |
| <span class="s">"actor"</span> <span class="p">:</span> <span class="p">{</span> |
| <span class="s">"displayName"</span> <span class="p">:</span> <span class="s">"moab"</span><span class="p">,</span> |
| <span class="s">"image"</span> <span class="p">:</span> <span class="p">{</span> |
| <span class="s">"duration"</span> <span class="p">:</span> <span class="mi">0</span><span class="p">,</span> |
| <span class="s">"height"</span> <span class="p">:</span> <span class="mi">80</span><span class="p">,</span> |
| <span class="s">"url"</span> <span class="p">:</span> <span class="s">"http://www.gravatar.com/avatar/"</span><span class="p">,</span> |
| <span class="s">"width"</span> <span class="p">:</span> <span class="mi">80</span> |
| <span class="p">},</span> |
| <span class="s">"uuid"</span> <span class="p">:</span> <span class="s">"d9693ec3-61c9-11e2-9ffc-02e81adcf3d0"</span><span class="p">,</span> |
| <span class="s">"email"</span> <span class="p">:</span> <span class="s">"massoddb@mfdsadfdsaoabl.com"</span><span class="p">,</span> |
| <span class="s">"username"</span> <span class="p">:</span> <span class="s">"moab"</span> |
| <span class="p">},</span> |
| <span class="s">"content"</span> <span class="p">:</span> <span class="s">"checking in code left and right!!"</span><span class="p">,</span> |
| <span class="s">"metadata"</span> <span class="p">:</span> <span class="p">{</span> |
| <span class="s">"cursor"</span> <span class="p">:</span> <span class="s">"gGkAAQMAgGkABgE5MLFh7gCAdQAQJIKhxefQEeGW9hIxOwbREgCAdQAQJNEP6ufQEeGW9hIxOwbREgA"</span><span class="p">,</span> |
| <span class="s">"path"</span> <span class="p">:</span> <span class="s">"/users/d9693ec3-61c9-11e2-9ffc-02e81adcf3d0/feed/2482a1c5-e7d0-11e1-96f6-12313b06d112"</span> |
| <span class="p">},</span> |
| <span class="s">"published"</span> <span class="p">:</span> <span class="mi">1345141694958</span><span class="p">,</span> |
| <span class="s">"verb"</span> <span class="p">:</span> <span class="s">"post"</span> |
| <span class="p">}</span> <span class="p">],</span> |
| <span class="s">"timestamp"</span> <span class="p">:</span> <span class="mi">1346438331316</span><span class="p">,</span> |
| <span class="s">"duration"</span> <span class="p">:</span> <span class="mi">144</span><span class="p">,</span> |
| <span class="s">"organization"</span><span class="p">:</span> <span class="s">"my-org"</span><span class="p">,</span> |
| <span class="s">"applicationName"</span><span class="p">:</span> <span class="s">"my-app"</span> |
| <span class="p">}</span> |
| </pre></div> |
| </div> |
| </div> |
| </div> |
| <div class="section" id="retrieving-a-group-s-activity-feed"> |
| <h2>Retrieving a group’s activity feed<a class="headerlink" href="#retrieving-a-group-s-activity-feed" title="Permalink to this headline">¶</a></h2> |
| <p>Use the GET method to retrieve the feed for a group. This gets a list of |
| all the activities that have been posted to this group, that is, the |
| activities for which this group has a relationship (owns).</p> |
| <div class="section" id="id10"> |
| <h3>Request URI<a class="headerlink" href="#id10" title="Permalink to this headline">¶</a></h3> |
| <div class="highlight-python"><div class="highlight"><pre><span class="n">GET</span> <span class="o">/</span><span class="p">{</span><span class="n">org_id</span><span class="p">}</span><span class="o">/</span><span class="p">{</span><span class="n">app_id</span><span class="p">}</span><span class="o">/</span><span class="n">groups</span><span class="o">/</span><span class="p">{</span><span class="n">uuid</span><span class="o">|</span><span class="n">groupname</span><span class="p">}</span><span class="o">/</span><span class="n">feed</span> |
| </pre></div> |
| </div> |
| <p>Parameters</p> |
| <table border="1" class="docutils"> |
| <colgroup> |
| <col width="24%" /> |
| <col width="76%" /> |
| </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>arg uuid|str</td> |
| <td>ing org_id Organization UUID or organization name</td> |
| </tr> |
| <tr class="row-odd"><td>arg uuid|str</td> |
| <td>ing app_id Application UUID or application name</td> |
| </tr> |
| <tr class="row-even"><td>arg uuid|str</td> |
| <td>ing groupname UUID or name of the group</td> |
| </tr> |
| </tbody> |
| </table> |
| </div> |
| <div class="section" id="id11"> |
| <h3>Example - Request<a class="headerlink" href="#id11" title="Permalink to this headline">¶</a></h3> |
| <div class="highlight-python"><div class="highlight"><pre>curl -X GET "https://api.usergrid.com/my-org/my-app/groups/mygroup/feed" |
| </pre></div> |
| </div> |
| </div> |
| <div class="section" id="id12"> |
| <h3>Example - Response<a class="headerlink" href="#id12" title="Permalink to this headline">¶</a></h3> |
| <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">"3400ba10-cd0c-11e1-bcf7-12313d1c4491"</span><span class="p">,</span> |
| <span class="s">"params"</span><span class="p">:</span> <span class="p">{},</span> |
| <span class="s">"path"</span><span class="p">:</span> <span class="s">"/groups/d87edec7-fc4d-11e1-9917-12313d1520f1/feed"</span><span class="p">,</span> |
| <span class="s">"uri"</span><span class="p">:</span> <span class="s">"https://api.usergrid.com/my-org/my-app/groups/d87edec7-fc4d-11e1-9917-12313d1520f1/feed"</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">"563f5d96-37f3-11e2-a0f7-02e81ae640dc"</span><span class="p">,</span> |
| <span class="s">"type"</span><span class="p">:</span> <span class="s">"activity"</span><span class="p">,</span> |
| <span class="s">"created"</span><span class="p">:</span> <span class="mi">1353952903811</span><span class="p">,</span> |
| <span class="s">"modified"</span><span class="p">:</span> <span class="mi">1353952903811</span><span class="p">,</span> |
| <span class="s">"actor"</span><span class="p">:</span> <span class="p">{</span> |
| <span class="s">"displayName"</span><span class="p">:</span> <span class="s">"John Doe"</span><span class="p">,</span> |
| <span class="s">"image"</span><span class="p">:</span> <span class="p">{</span> |
| <span class="s">"duration"</span><span class="p">:</span> <span class="mi">0</span><span class="p">,</span> |
| <span class="s">"height"</span><span class="p">:</span> <span class="mi">80</span><span class="p">,</span> |
| <span class="s">"url"</span><span class="p">:</span> <span class="s">"http://www.gravatar.com/avatar/"</span><span class="p">,</span> |
| <span class="s">"width"</span><span class="p">:</span> <span class="mi">80</span> |
| <span class="p">},</span> |
| <span class="s">"uuid"</span><span class="p">:</span> <span class="s">"1f3567aa-da83-11e1-afad-12313b01d5c1"</span><span class="p">,</span> |
| <span class="s">"email"</span><span class="p">:</span> <span class="s">"john.doe@gmail.com"</span><span class="p">,</span> |
| <span class="s">"username"</span><span class="p">:</span> <span class="s">"john.doe"</span> |
| <span class="p">},</span> |
| <span class="s">"content"</span><span class="p">:</span> <span class="s">"Hello World!"</span><span class="p">,</span> |
| <span class="s">"metadata"</span><span class="p">:</span> <span class="p">{</span> |
| <span class="s">"cursor"</span><span class="p">:</span> <span class="s">"gGkAAQMAgGkABgE7PeHCgwCAdQAQVj9dljfzEeKg9wLoGuZA3ACAdQAQVkVRCTfzEeKg9wLoGuZA3AA"</span><span class="p">,</span> |
| <span class="s">"path"</span><span class="p">:</span> <span class="s">"/groups/d87edec7-fc4d-11e1-9917-12313d1520f1/feed/563f5d96-37f3-11e2-a0f7-02e81ae640dc"</span> |
| <span class="p">},</span> |
| <span class="s">"published"</span><span class="p">:</span> <span class="mi">1353952903811</span><span class="p">,</span> |
| <span class="s">"verb"</span><span class="p">:</span> <span class="s">"post"</span> |
| <span class="p">}</span> |
| <span class="p">],</span> |
| <span class="s">"timestamp"</span><span class="p">:</span> <span class="mi">1353953272756</span><span class="p">,</span> |
| <span class="s">"duration"</span><span class="p">:</span> <span class="mi">29</span><span class="p">,</span> |
| <span class="s">"organization"</span><span class="p">:</span> <span class="s">"my-org"</span><span class="p">,</span> |
| <span class="s">"applicationName"</span><span class="p">:</span> <span class="s">"my-app"</span> |
| <span class="p">}</span> |
| </pre></div> |
| </div> |
| </div> |
| </div> |
| </div> |
| |
| |
| </div> |
| </div> |
| <footer> |
| |
| <div class="rst-footer-buttons" role="navigation" aria-label="footer navigation"> |
| |
| <a href="user-connections.html" class="btn btn-neutral float-right" title="Social Graph Connections" accesskey="n">Next <span class="fa fa-arrow-circle-right"></span></a> |
| |
| |
| <a href="group.html" class="btn btn-neutral" title="Working with group data" 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:'2.x', |
| 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> |