You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@usergrid.apache.org by ti...@apache.org on 2013/11/18 19:51:22 UTC
svn commit: r1543106 [3/23] - in /incubator/usergrid/site: ./ content/
content/bootstrap/ content/community/ content/css/ content/docs/
content/font/ content/img/ content/img/check_flat/ content/js/
content/static/ layouts/ lib/ lib/helpers/ publish/ p...
Added: incubator/usergrid/site/content/docs/activity.md
URL: http://svn.apache.org/viewvc/incubator/usergrid/site/content/docs/activity.md?rev=1543106&view=auto
==============================================================================
--- incubator/usergrid/site/content/docs/activity.md (added)
+++ incubator/usergrid/site/content/docs/activity.md Mon Nov 18 18:51:18 2013
@@ -0,0 +1,1128 @@
+---
+title: Activity
+category: docs
+layout: docs
+---
+
+Activity
+========
+
+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.
+
+App services provides an activity entity that is specifically designed
+for data streams. An activity is an entity type that represents activity
+stream actions (see the [JSON Activity Streams 1.0
+specification](http://activitystrea.ms/specs/json/1.0/) for more
+information about these actions).
+
+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 (/users/{uuid|username}/activities) as
+an "outbox" of news items created by the user. Think of the Feed
+endpoint (/users/{uuid|username}/feed) as an "inbox" of news items meant
+to be seen or consumed by the user.
+
+A user can also post an activity to a group (located at
+/groups/{uuid|groupname}/activities). 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.
+
+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.
+
+Using App services APIs you can create, retrieve, update, and delete
+activity entities. See You do not have access to view this node for
+descriptions of these APIs.
+
+**Note:**Â Although not shown in the API examples below, you need to
+provide a valid access token with each API call. See [Authenticating
+users and application
+clients](/authenticating-users-and-application-clients) for details.
+
+Creating an activity {dir="ltr"}
+--------------------
+
+Use the  POST method to create an activity in the activities collection.
+
+### Request URI
+
+POST /{org\_id}/{app\_id}/users/{uuid|username}/activities {request
+body}
+
+### Parameters
+
++--------------------------------------+--------------------------------------+
+| Parameter | Description |
++======================================+======================================+
+| arg uuid|string org\_id | Organization UUID or organization |
+| | name |
++--------------------------------------+--------------------------------------+
+| arg uuid|string app\_id | Application UUID or application name |
++--------------------------------------+--------------------------------------+
+| request body | One or more sets of activity |
+| | properties: |
+| | |
+| | { |
+| | Â Â "actor": |
+| | Â Â Â Â { |
+| | Â Â Â Â "displayName":"John Doe", |
+| | Â Â Â Â "uuid":"1f3567aa-da83-11e1-a |
+| | fad-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!"Â Â Â Â |
+| | } |
++--------------------------------------+--------------------------------------+
+
+### Example - Request
+
+- [cURL](#curl_create_activity)
+- [JavaScript (HTML5)](#javascript_create_activity)
+- [Ruby](#ruby_create_activity)
+- [Node.js](#nodejs_create_activity)
+
+<!-- -->
+
+ 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!"}'
+
+The example assumes use of the [JavaScript (HTML5)
+SDK](https://github.com/apigee/usergrid-javascript-sdk).
+
+ var options = {
+ method:'POST',
+ endpoint:'users/john.doe/activities',
+ body:{"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!"}
+ };
+ client.request(options, function (err, data) {
+ if (err) {
+ //error â POST failed
+ } else {
+ // success â POST worked. Data will contain raw results from API call
+ }
+ });
+
+The example assumes use of the [Ruby
+SDK](https://github.com/scottganyo/usergrid_iron).
+
+ app = Usergrid::Application.new 'https://api.usergrid.com/my-org/my-app/'
+ app.create_activity { 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!' }
+
+The example assumes use of the [Node.js
+module](https://github.com/apigee/usergrid-node-module).
+
+ var options = {
+ method:'POST',
+ endpoint:'users/john.doe/activities',
+ body:{"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!"}
+ };
+ client.request(options, function (err, data) {
+ if (err) {
+ //error â POST failed
+ } else {
+ // success â POST worked. Data will contain raw results from API call
+ }
+ });
+
+### Example - Response
+
+ {
+ Â "action" : "post",
+ Â "application" : "5111c463-6a42-11e1-b6dd-1231380a0284",
+ Â "params" : {
+ Â },
+ Â "path" : "/users/1f3567aa-da83-11e1-afad-12313b01d5c1/activities",
+ Â "uri" : "https://api.usergrid.com/5111c463-6a42-11e1-b6dd-1231380a0284/users/1f3567aa-da83-11e1-afad-12313b01d5c1/activities",
+ Â "entities" : [ {
+ Â Â Â "uuid" : "da448955-f3aa-11e1-8042-12313d331ae8",
+ Â Â Â "type" : "activity",
+ Â Â Â "created" : 1346445092974,
+ Â Â Â "modified" : 1346445092974,
+ Â Â Â "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" : "Hello World!",
+ Â Â Â "metadata" : {
+ Â Â Â Â Â "path" : "/users/1f3567aa-da83-11e1-afad-12313b01d5c1/activities/da448955-f3aa-11e1-8042-12313d331ae8"
+ Â Â Â },
+ Â Â Â "published" : 1346445092974,
+ Â Â Â "verb" : "post"
+ Â } ],
+ Â "timestamp" : 1346445092827,
+ Â "duration" : 1406,
+ Â "organization": "my-org",
+ Â "applicationName": "my-app"
+ }
+
+**Note:** 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:
+
+POST /{org\_id}/{app\_id}/users/me/activities {request body}
+
+The users/me 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 /users/me.
+
+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 /activites endpoint to users who have the permission to read that
+endpoint.
+
+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
+[System-defined activity properties](#properties)). 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 Apache Usergrid entity, you
+can also create custom properties.
+
+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.â
+
+Posting an activity to a group {dir="ltr"}
+------------------------------
+
+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 /activities 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.
+
+Request URI
+
+POST /{org\_id}/{app\_id}/groups/{uuid|groupname}/activities {request
+body}
+
+### Parameters
+
++--------------------------------------+--------------------------------------+
+| 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 |
++--------------------------------------+--------------------------------------+
+| request body | One or more sets of activity |
+| | properties: |
+| | |
+| | { |
+| | Â Â "actor": |
+| | Â Â Â Â { |
+| | Â Â Â Â "displayName":"John Doe", |
+| | Â Â Â Â "uuid":"1f3567aa-da83-11e1-a |
+| | fad-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!"Â Â Â Â |
+| | } |
++--------------------------------------+--------------------------------------+
+
+### Example - Request
+
+- [cURL](#curl_post_activity_group)
+- [JavaScript (HTML5)](#javascript_post_activity_group)
+- [Ruby](#ruby_post_activity_group)
+- [Node.js](#nodejs_post_activity_group)
+
+<!-- -->
+
+ 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!"}'
+
+The example assumes use of the [JavaScript (HTML5)
+SDK](https://github.com/apigee/usergrid-javascript-sdk).
+
+ var options = {
+ method:'POST',
+ endpoint:'groups/mygroup/activities',
+ body:{"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!"}
+ };
+ client.request(options, function (err, data) {
+ if (err) {
+ //error â POST failed
+ } else {
+ //success â POST worked. Data will contain raw results from API call.
+ }
+ });
+
+The example assumes use of the [Ruby
+SDK](https://github.com/scottganyo/usergrid_iron).
+
+ app = Usergrid::Application.new 'https://api.usergrid.com/my-org/my-app/'
+ app['groups/mygroup/activities'].post { 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!' }
+
+The example assumes use of the [Node.js
+module](https://github.com/apigee/usergrid-node-module).
+
+ var options = {
+ method:'POST',
+ endpoint:'groups/mygroup/activities',
+ body:{"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!"}
+ };
+ client.request(options, function (err, data) {
+ if (err) {
+ //error â POST failed
+ } else {
+ //success â POST worked. Data will contain raw results from API call.
+ }
+ });
+
+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.
+
+### Example - Response
+
+ {
+ "action": "post",
+ "application": "3400ba10-cd0c-11e1-bcf7-12313d1c4491",
+ "params": {},
+ "path": "/groups/d87edec7-fc4d-11e1-9917-12313d1520f1/activities",
+ "uri": "https://api.usergrid.com/my-org/my-app/groups/d87edec7-fc4d-11e1-9917-12313d1520f1/activities",
+ "entities": [
+ {
+ "uuid": "563f5d96-37f3-11e2-a0f7-02e81ae640dc",
+ "type": "activity",
+ "created": 1353952903811,
+ "modified": 1353952903811,
+ "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": "Hello World!",
+ "metadata": {
+ "path": "/groups/d87edec7-fc4d-11e1-9917-12313d1520f1/activities/563f5d96-37f3-11e2-a0f7-02e81ae640dc"
+ },
+ "published": 1353952903811,
+ "verb": "post"
+ }
+ ],
+ "timestamp": 1353952903800,
+ "duration": 81,
+ "organization": "my-org",
+ "applicationName": "my-app"
+
+Creating an activity for a user's followers in a group {dir="ltr"}
+------------------------------------------------------
+
+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.
+
+When you create an activity for a userâs followers in a group:
+
+- The activity is accessible at the /activities endpoint to users who
+ have the permission to read that endpoint. The activity will not be
+ cross-posted to the groupâs activity endpoint
+ (/groups/{uuid|groupname}/activities)
+- A relationship is automatically created between the activity entity
+ that was just created and the user within that group
+ (/groups/{uuid|groupname}/users/{uuid|username})
+- The user within the group
+ (/groups/{uuid|groupname}/users/{uuid|username}) becomes the owner
+ of the activity (through the owner property in the activity).
+
+### Request URI
+
+POST
+/{org\_id}/{app\_id}/groups/{uuid|groupname}/users/{uuid|username}/activities
+{request body}
+
+### Parameters
+
++--------------------------------------+--------------------------------------+
+| 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: |
+| | |
+| | { |
+| | Â Â "actor": |
+| | Â Â Â Â { |
+| | Â Â Â Â "displayName":"John Doe", |
+| | Â Â Â Â "uuid":"1f3567aa-da83-11e1-a |
+| | fad-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!"Â Â Â Â |
+| | } |
++--------------------------------------+--------------------------------------+
+
+### Example - Request
+
+- [cURL](#curl_post_activity_user_group)
+- [JavaScript (HTML5)](#javascript_post_activity_user_group)
+- [Ruby](#ruby_post_activity_user_group)
+- [Node.js](#nodejs_post_activity_user_group)
+
+<!-- -->
+
+ 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!"}'
+
+The example assumes use of the [JavaScript (HTML5)
+SDK](https://github.com/apigee/usergrid-javascript-sdk).
+
+ var options = {
+ method:'POST',
+ endpoint:'groups/mygroup/users/john.doe/activities',
+ body:{"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!"}
+ };
+ client.request(options, function (err, data) {
+ if (err) {
+ //error â POST failed
+ } else {
+ //success â POST worked. Data will contain raw results from API call.
+ }
+ });
+
+The example assumes use of the [Ruby
+SDK](https://github.com/scottganyo/usergrid_iron).
+
+ app = Usergrid::Application.new 'https://api.usergrid.com/my-org/my-app/'
+ app['groups/mygroup/users/john.doe/activities'].post { 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!' }
+
+The example assumes use of the [Node.js
+module](https://github.com/apigee/usergrid-node-module).
+
+ var options = {
+ method:'POST',
+ endpoint:'groups/mygroup/users/john.doe/activities',
+ body:{"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!"}
+ };
+ client.request(options, function (err, data) {
+ if (err) {
+ //error â POST failed
+ } else {
+ //success â POST worked. Data will contain raw results from API call.
+ }
+ });
+
+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.
+
+### Example - Response
+
+ {
+ "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"
+
+Getting a userâs activities {dir="ltr"}
+---------------------------
+
+Use the GET method to retrieve a userâs activities. This returns the
+activities posted on the user (that is, to
+/users/{uuid|username}/activities), but not the activities of the people
+that user follows. To retrieve the userâs activities and activities of
+the users he follows, you need to get the userâs feed.
+
+### Request URI
+
+GET /{org\_id}/{app\_id}/users/{uuid|username}/activities
+
+### Parameters
+
+ 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 username UUID or name of the user
+
+### Example - Request
+
+- [cURL](#curl_get_user_activities)
+- [JavaScript (HTML5)](#javascript_get_user_activities)
+- [Ruby](#ruby_get_user_activities)
+- [Node.js](#nodejs_get_user_activities)
+
+<!-- -->
+
+ curl -X GET "https://api.usergrid.com/my-org/my-app/users/john.doe/activities"
+
+The example assumes use of the [JavaScript (HTML5)
+SDK](https://github.com/apigee/usergrid-javascript-sdk).
+
+ var options = {
+ method:'GET',
+ endpoint:'users/john.doe/activities'
+ };
+ client.request(options, function (err, data) {
+ if (err) {
+ //error â GET failed
+ } else {
+ //success GET worked. Data will contain raw results from API call.
+ }
+ });
+
+The example assumes use of the [Ruby
+SDK](https://github.com/scottganyo/usergrid_iron).
+
+ app = Usergrid::Application.new 'https://api.usergrid.com/my-org/my-app/'
+ app['users/john.doe/activities'].get
+
+The example assumes use of the [Node.js
+module](https://github.com/apigee/usergrid-node-module).
+
+ var options = {
+ method:'GET',
+ endpoint:'users/john.doe/activities'
+ };
+ client.request(options, function (err, data) {
+ if (err) {
+ //error â GET failed
+ } else {
+ //success GET worked. Data will contain raw results from API call.
+ }
+ });
+
+### Example - Response
+
+ {
+ "action" : "get",
+ "application" : "3400ba10-cd0c-11e1-bcf7-12313d1c4491",
+ "params" : { },
+ "path" : "/users/5c0c1789-d503-11e1-b36a-12313b01d5c1/activities",
+ "uri" : "https://api.usergrid.com/my-org/my-app/users/5c0c1789-d503-11e1-b36a-12313b01d5c1/activities",
+ "entities" : [ {
+ "uuid" : "d57e5b00-37f1-11e2-a0f7-02e81ae640dc",
+ "type" : "activity",
+ "created" : 1353952258301,
+ "modified" : 1353952258301,
+ "actor" : {
+ "displayName" : "John Doe",
+ "image" : {
+ "duration" : 0,
+ "height" : 80,
+ "url" : "http://www.gravatar.com/avatar/",
+ "width" : 80
+ },
+ "uuid" : "1f3567aa-da83-11e1-afad-12313b01d5c1",
+ "email" : "john.doe@gmail.com",
+ "username" : "john.doe"
+ },
+ "content" : "Hello World!",
+ "metadata" : {
+ "path" : "/users/5c0c1789-d503-11e1-b36a-12313b01d5c1/activities/d57e5b00-37f1-11e2-a0f7-02e81ae640dc"
+ },
+ "published" : 1353952258301,
+ "verb" : "post"
+ },
+ "timestamp" : 1355933909077,
+ "duration" : 39,
+ "organization" : "my-org",
+ "applicationName" : "my-app"}
+
+Getting a groupâs activities {dir="ltr"}
+----------------------------
+
+Use the GET method to retrieve a groupâs activities. This returns the
+activities created on or by the group (that is, to
+/groups/{uuid|groupname}/activities), but not the activities of
+followers of group members. To retrieve the groupâs activities and
+activities of followers, you need to get the groupâs feed.
+
+### Request URI
+
+GET /{org\_id}/{app\_id}/groups/{uuid|groupname}/activities
+
+### Parameters
+
+ 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
+
+### Example - Request
+
+- [cURL](#curl_get_group_activities)
+- [JavaScript (HTML5)](#javascript_get_group_activities)
+- [Ruby](#ruby_get_group_activities)
+- [Node.js](#nodejs_get_group_activities)
+
+<!-- -->
+
+ curl -X GET "https://api.usergrid.com/my-org/my-app/groups/mygroup/activities"
+
+The example assumes use of the [JavaScript (HTML5)
+SDK](https://github.com/apigee/usergrid-javascript-sdk).
+
+ var options = {
+ method:'GET',
+ endpoint:'groups/mygroup/activities'
+ };
+ client.request(options, function (err, data) {
+ if (err) {
+ //error â GET failed
+ } else {
+ //success GET worked. Data will contain raw results from API call.
+ }
+ });
+
+The example assumes use of the [Ruby
+SDK](https://github.com/scottganyo/usergrid_iron).
+
+ app = Usergrid::Application.new 'https://api.usergrid.com/my-org/my-app/'
+ app['groups/mygroup/activities'].get
+
+The example assumes use of the [Node.js
+module](https://github.com/apigee/usergrid-node-module).
+
+ var options = {
+ method:'GET',
+ endpoint:'groups/mygroup/activities'
+ };
+ client.request(options, function (err, data) {
+ if (err) {
+ //error â GET failed
+ } else {
+ //success GET worked. Data will contain raw results from API call.
+ }
+ });
+
+### Example - Response
+
+ {
+ "action" : "get",
+ "application" : "3400ba10-cd0c-11e1-bcf7-12313d1c4491",
+ "params" : { },
+ "path" : "/groups/d87edec7-fc4d-11e1-9917-12313d1520f1/activities",
+ "uri" : "https://api.usergrid.com/my-org/my-app//groups/d87edec7-fc4d-11e1-9917-12313d1520f1/activities",
+ "entities" : [ {
+ "uuid" : "e7a47a41-4310-11e2-8861-02e81adcf3d0",
+ "type" : "activity",
+ "created" : 1355175065939,
+ "modified" : 1355175065939,
+ "actor" : {
+ "displayName" : "Martin Smith",
+ "id" : "tag:example.org,2011:martin",
+ "image" : {
+ "duration" : 0,
+ "height" : 250,
+ "url" : "http://example.org/martin/image",
+ "width" : 250
+ },
+ "objectType" : "person",
+ "url" : "http://example.org/martin"
+ },
+ "metadata" : {
+ "path" : "/groups/d87edec7-fc4d-11e1-9917-12313d1520f1/activities/e7a47a41-4310-11e2-8861-02e81adcf3d0"
+ },
+ "object" : {
+ "id" : "tag:example.org,2011:abc123/xyz",
+ "url" : "http://example.org/blog/2011/02/entry"
+ },
+ "published" : 1355175065939,
+ "target" : {
+ "url" : "http://example.org/blog/",
+ "objectType" : "blog",
+ "id" : "tag:example.org,2011:abc123",
+ "displayName" : "Martin's Blog"
+ },
+ "verb" : "post"
+ }, {
+ "uuid" : "563f5d96-37f3-11e2-a0f7-02e81ae640dc",
+ "type" : "activity",
+ "created" : 1353952903811,
+ "modified" : 1353952903811,
+ "actor" : {
+ "displayName" : "John Doe",
+ "image" : {
+ "duration" : 0,
+ "height" : 80,
+ "url" : "http://www.gravatar.com/avatar/",
+ "width" : 80
+ },
+ "uuid" : "1f3567aa-da83-11e1-afad-12313b01d5c1",
+ "email" : "john.doe@gmail.com",
+ "username" : "john.doe"
+ },
+ "content" : "Hello World!",
+ "metadata" : {
+ "path" : "/groups/d87edec7-fc4d-11e1-9917-12313d1520f1/activities/563f5d96-37f3-11e2-a0f7-02e81ae640dc"
+ },
+ "published" : 1353952903811,
+ "verb" : "post"
+ } ],
+ "timestamp" : 1355934203039,
+ "duration" : 141,
+ "organization" : "my-org",
+ "applicationName" : "my-app"
+ }
+
+Getting a userâs feed {dir="ltr"}
+---------------------
+
+Use the GET method to retrieve a userâs feed.
+
+### Request URI
+
+GET /{org\_id}/{app\_id}/users/{uuid|username}/feed
+
+### Parameters
+
+ 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 username UUID or name of the user
+
+### Example - Request
+
+- [cURL](#curl_get_user_feed)
+- [JavaScript (HTML5)](#javascript_get_user_feed)
+- [Ruby](#ruby_get_user_feed)
+- [Node.js](#nodejs_get_user_feed)
+
+<!-- -->
+
+ curl -X GET "https://api.usergrid.com/my-org/my-app/users/john.doe/feed"
+
+The example assumes use of the [JavaScript (HTML5)
+SDK](https://github.com/apigee/usergrid-javascript-sdk).
+
+ var options = {
+ method:'GET',
+ endpoint:'users/john.doe/feed'
+ };
+ client.request(options, function (err, data) {
+ if (err) {
+ //error â GET failed
+ } else {
+ //success GET worked. Data will contain raw results from API call.
+ }
+ });
+
+The example assumes use of the [Ruby
+SDK](https://github.com/scottganyo/usergrid_iron).
+
+ app = Usergrid::Application.new 'https://api.usergrid.com/my-org/my-app/'
+ app['users/john.doe/feed'].get
+
+The example assumes use of the [Node.js
+module](https://github.com/apigee/usergrid-node-module).
+
+ var options = {
+ method:'GET',
+ endpoint:'users/john.doe/feed'
+ };
+ client.request(options, function (err, data) {
+ if (err) {
+ //error â GET failed
+ } else {
+ //success GET worked. Data will contain raw results from API call.
+ }
+ });
+
+### Example - Response
+
+ {
+ "action" : "get",
+ "application" : "5111c463-6a42-11e1-b6dd-1231380a0284",
+ "params" : {
+ "_" : [ "1346438183429" ]
+ },
+ "path" : "/users/1f3567aa-da83-11e1-afad-12313b01d5c1/feed",
+ "uri" : "https://api.usergrid.com/5111c463-6a42-11e1-b6dd-1231380a0284/users/1f3567aa-da83-11e1-afad-12313b01d5c1/feed",
+ "entities" : [ {
+ "uuid" : "ffd79647-f399-11e1-aec3-12313b06ae01",
+ "type" : "activity",
+ "created" : 1346437854569,
+ "modified" : 1346437854569,
+ "actor" : {
+ "displayName" : "John Doe",
+ "image" : {
+ "duration" : 0,
+ "height" : 80,
+ "url" : "http://www.gravatar.com/avatar/",
+ "width" : 80
+ },
+ "uuid" : "1f3567aa-da83-11e1-afad-12313b01d5c1",
+ "email" : "john.doe@gmail.com",
+ "username" : "john.doe"
+ },
+ "content" : "Hello World!",
+ "metadata" : {
+ "cursor" : "gGkAAQMAgGkABgE5ffM1aQCAdQAQ_9eWR_OZEeGuwxIxOwauAQCAdQAQABlaOvOaEeGuwxIxOwauAQA",
+ "path" : "/users/1f3567aa-da83-11e1-afad-12313b01d5c1/feed/ffd79647-f399-11e1-aec3-12313b06ae01"
+ },
+ "published" : 1346437854569,
+ "verb" : "post"
+ }, {
+ "uuid" : "2482a1c5-e7d0-11e1-96f6-12313b06d112",
+ "type" : "activity",
+ "created" : 1345141694958,
+ "modified" : 1345141694958,
+ "actor" : {
+ "displayName" : "moab",
+ "image" : {
+ "duration" : 0,
+ "height" : 80,
+ "url" : "http://www.gravatar.com/avatar/",
+ "width" : 80
+ },
+ "uuid" : "1f3567aa-da83-11e1-afad-12313b01d5c1",
+ "email" : "massoddb@mfdsadfdsaoabl.com",
+ "username" : "moab"
+ },
+ "content" : "checking in code left and right!!",
+ "metadata" : {
+ "cursor" : "gGkAAQMAgGkABgE5MLFh7gCAdQAQJIKhxefQEeGW9hIxOwbREgCAdQAQJNEP6ufQEeGW9hIxOwbREgA",
+ "path" : "/users/1f3567aa-da83-11e1-afad-12313b01d5c1/feed/2482a1c5-e7d0-11e1-96f6-12313b06d112"
+ },
+ "published" : 1345141694958,
+ "verb" : "post"
+ } ],
+ "timestamp" : 1346438331316,
+ "duration" : 144,
+ "organization": "my-org",
+ "applicationName": "my-app"
+ }
+
+When a user creates an activity, a relationship is established between
+the activity and the user who created it. The activities in the userâs
+feed are based on this relationship as well as  any following
+relationships that the user has, and any groups in which the user
+belongs. So when a user asks to get his feed, what he gets is a list of
+(1) all the activities that the user owns, (2) all the activities posted
+by any users this user is following, and (3) any activities owned by any
+groups in which this user belongs.
+
+The user john.doeâs feed includes activities posted by user moab because
+john.doe follows moab.
+
+Getting a groupâs feed {dir="ltr"}
+----------------------
+
+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).
+
+### Request URI
+
+GET /{org\_id}/{app\_id}/groups/{uuid|groupname}/feed
+
+### Parameters
+
+ 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
+
+### Example - Request
+
+- [cURL](#curl_get_group_feed)
+- [JavaScript (HTML5)](#javascript_get_group_feed)
+- [Ruby](#ruby_get_group_feed)
+- [Node.js](#nodejs_get_group_feed)
+
+<!-- -->
+
+ curl -X GET "https://api.usergrid.com/my-org/my-app/groups/mygroup/feed"
+
+The example assumes use of the [JavaScript (HTML5)
+SDK](https://github.com/apigee/usergrid-javascript-sdk).
+
+ var options = {
+ method:'GET',
+ endpoint:'groups/mygroup/feed'
+ };
+ client.request(options, function (err, data) {
+ if (err) {
+ //error â GET failed
+ } else {
+ //success â GET worked. Data will contain raw results from API call.
+ }
+ });
+
+The example assumes use of the [Ruby
+SDK](https://github.com/scottganyo/usergrid_iron).
+
+ app = Usergrid::Application.new 'https://api.usergrid.com/my-org/my-app/'
+ app['groups/mygroup/feed'].get
+
+The example assumes use of the [Node.js
+module](https://github.com/apigee/usergrid-node-module).
+
+ var options = {
+ method:'GET',
+ endpoint:'groups/mygroup/feed'
+ };
+ client.request(options, function (err, data) {
+ if (err) {
+ //error â GET failed
+ } else {
+ //success â GET worked. Data will contain raw results from API call.
+ }
+ });
+
+### Example - Response
+
+ {
+ "action": "get",
+ "application": "3400ba10-cd0c-11e1-bcf7-12313d1c4491",
+ "params": {},
+ "path": "/groups/d87edec7-fc4d-11e1-9917-12313d1520f1/feed",
+ "uri": "https://api.usergrid.com/my-org/my-app/groups/d87edec7-fc4d-11e1-9917-12313d1520f1/feed",
+ "entities": [
+ {
+ "uuid": "563f5d96-37f3-11e2-a0f7-02e81ae640dc",
+ "type": "activity",
+ "created": 1353952903811,
+ "modified": 1353952903811,
+ "actor": {
+ "displayName": "John Doe",
+ "image": {
+ "duration": 0,
+ "height": 80,
+ "url": "http://www.gravatar.com/avatar/",
+ "width": 80
+ },
+ "uuid": "1f3567aa-da83-11e1-afad-12313b01d5c1",
+ "email": "john.doe@gmail.com",
+ "username": "john.doe"
+ },
+ "content": "Hello World!",
+ "metadata": {
+ "cursor": "gGkAAQMAgGkABgE7PeHCgwCAdQAQVj9dljfzEeKg9wLoGuZA3ACAdQAQVkVRCTfzEeKg9wLoGuZA3AA",
+ "path": "/groups/d87edec7-fc4d-11e1-9917-12313d1520f1/feed/563f5d96-37f3-11e2-a0f7-02e81ae640dc"
+ },
+ "published": 1353952903811,
+ "verb": "post"
+ }
+ ],
+ "timestamp": 1353953272756,
+ "duration": 29,
+ "organization": "my-org",
+ "applicationName": "my-app"
+
+Activity properties
+-------------------
+
+The following are the system-defined properties for activity entities.
+You can create application-specific properties for an activity entity in
+addition to the system-defined properties. The system-defined properties
+are reserved. You cannot use these names to create other properties for
+an activity entity. In addition the activities name is reserved for the
+activities collection â you can't use it to name another collection.
+
+ Property Type Description
+ ----------- ---------------- ------------------------------------------------------------------------------------------------------------------------------------------
+ uuid UUID Activityâs unique entity ID
+ type string "activity"
+ created long [UNIX timestamp](http://en.wikipedia.org/wiki/Unix_time) of entity creation
+ modified long [UNIX timestamp](http://en.wikipedia.org/wiki/Unix_time) of entity modification
+ actor ActivityObject Entity that performs the action of the activity (see [JSON Activity Streams 1.0 specification](http://activitystrea.ms/specs/json/1.0/))
+ content string Description of the activity
+ icon MediaLink Visual representation of a media link resource (see [JSON Activity Streams 1.0 specification](http://activitystrea.ms/specs/json/1.0/))
+ category string Category used to organize activities
+ verb string Action that the actor performs (for example, *post*)
+ published long [UNIX timestamp](http://en.wikipedia.org/wiki/Unix_time) when the activity was published
+ object ActivityObject Object on which the action is performed (see [JSON Activity Streams 1.0 specification](http://activitystrea.ms/specs/json/1.0/))
+ title string Title or headline for the activity
+
+Set propertyÂ
+-------------
+
+Activities have the following set property.
+
+ Set Type Description
+ ------------- -------- -------------------------------------
+ connections string Set of connections for the activity
+
+Â
+
+Sample app
+----------
+
+The Messagee sample app is a simple Twitter-style messaging application
+that leverages the activity stream functionality of App services. The
+source for the application is available in HTML5 (JavaScript), iOS, and
+Android. You can download the source from github at:
+
+- [https://github.com/apigee/usergrid-sample-html5-messagee](https://github.com/apigee/usergrid-sample-html5-messagee)
+ Â (HTML5)
+- [https://github.com/usergrid/usergrid-sample-ios-messagee](https://github.com/usergrid/usergrid-sample-ios-messagee)
+ (iOS)
+- [https://github.com/apigee/usergrid-sample-android-messagee](https://github.com/apigee/usergrid-sample-android-messagee)
+ (Android)
+
Added: incubator/usergrid/site/content/docs/admin-portal.md
URL: http://svn.apache.org/viewvc/incubator/usergrid/site/content/docs/admin-portal.md?rev=1543106&view=auto
==============================================================================
--- incubator/usergrid/site/content/docs/admin-portal.md (added)
+++ incubator/usergrid/site/content/docs/admin-portal.md Mon Nov 18 18:51:18 2013
@@ -0,0 +1,509 @@
+---
+title: Admin portal
+category: docs
+layout: docs
+---
+
+Admin portal
+============
+
+The *admin portal* is the primary administrative user interface for
+working with App services. The portal is also the most complete
+reference application that demonstrates how to incorporate App services
+with JavaScript.
+
+The admin portal is available online at
+[https://apigee.com/usergrid/](https://apigee.com/usergrid/). The portal
+source code is fully open source and forkable, available for download on
+GitHub at
+[https://github.com/usergrid/portal](https://github.com/usergrid/portal).
+You can easily extend the portal, embed it into your own applications,
+or inspect the code to learn best practices associated with the App
+services API. The App services JavaScript client is also part of the
+GitHub portal project.
+
+The portal opens in your default web browser, either Safari, Firefox, or
+Google Chrome. The article [Messagee Example](/messagee-example)
+describes how to use the portal to run a sample application, whereas
+this section describes portal components in more detail and highlights
+App services features.
+
+Account Home page
+-----------------
+
+When you log in to the portal, you are presented with a Home page for
+managing applications and data for your organization. The Home page
+displays:
+
+- Applications associated with the currently selected organization
+- Administrators that are part of that organization
+- API credentials for the organization
+- Activities performed recently by administrators
+- A menu for building, organizing, and managing application content
+
+Applications
+------------
+
+For every app that you build, you need a defined application space
+within App services. Â By default, a test application called "sandbox" is
+created for you automatically. For ease of use, this default app has all
+authentication disabled and should be used for learning / testing
+purposes only. You may also create as many additional applications as
+needed.
+
+This unique application space allows each app to have its own private
+infrastructure to store its objects and data. In some cases, if you have
+multiple apps that share much of the same data and users, you might
+represent them in App services as a single application, which would
+allow those apps to share the same data space.
+
+### Application Dashboard
+
+The Dashboard shows a variety of statistical data for the selected
+application. You can see the activity level, the total number of
+entities, entities created in the last day, week, and month, and other
+vital statistics for monitoring application health as well as quota
+limits.
+
+### Administration for multiple organizations
+
+The portal is designed to let you work within the context of a single
+organization at any one point in time. Because it is possible to be an
+administrator for multiple organizations, you can switch between
+organizations using the menu in the upper right corner.
+
+Authentication credentials
+--------------------------
+
+The portal provides a convenient way to set and retrieve credentials for
+API access. If you click your email address at the top of the Home page,
+you can set your password for both the portal and for OAuth2
+username/password Admin-level access. On the Home page for the selected
+organization, you can see OAuth2 client credentials for
+organization-wide access to applications owned by that organization.
+Clicking the Settings button (on the left sidebar) displays OAuth2
+credentials for the selected application. See the discussion on the [App
+services security model](/app-services-security-model) for more
+information on specifying credentials and authentication.
+
+Exploring the API using the shell
+---------------------------------
+
+When you first create a new Organization account, there are no
+applications associated with the account. To create an application,
+click New Application in your organization's Home page. You are
+presented with a dialog box that prompts you for the information needed
+to create a new app. When the app is created, a number of options are
+enabled in the left sidebar for viewing and administering that
+application's data. Before you get started with the high-level tools,
+create a new application, go to the left sidebar, and click the Shell
+button to try out a few basic API commands.
+
+### Entering API requests in the shell
+
+The shell interface is a simple way to get started using the App
+services API. It provides a command-line environment within your web
+browser for trying out interactive commands. One thing to keep in mind
+when using the shell is that App services API endpoints usually take the
+form of:
+
+ https://api.usergrid.com/my-org-id/my-app-id/users
+
+where my-org-id is the organization identifier(uuid), my-app-id is your
+application identifier(uuid) and users refers to the collection of user
+objects defined for your application. Refer to the [Using the
+API](/using-api) section for more information on constructing API
+requests.
+
+When using the shell, you can abbreviate a fully qualified path name,
+omitting everything through the application identifier. The above URL
+request, which lists all the users in the application my-app-id, simply
+becomes:
+
+ /users
+
+If you type /users into the shell, it's the same as an HTTP GET command
+to the API endpoint for the currently selected portal application. (The
+current application is selected using the Applications menu in the left
+sidebar.)
+
+To create a new user entity using the shell, enter the following and
+press return:
+
+ post /users {"username":"john.doe","email":"john.doe@gmail.com"}
+
+Note that there is a space after the path and before the JSON
+representation.
+
+You've now created a new user in your application. You should see
+something like the following displayed as a result:
+
+ > post /users {"username":"john.doe","email":"john.doe@gmail.com"}
+ /users
+ {
+ "action": "post",
+ "application": "1c8f60e4-da67-11e0-b93d-12313f0204bb",
+ "params": {},
+ "path": "/users",
+ "uri": "https://api.usergrid.com/1c8f60e4-da67-11e0-b93d-12313f0204bb/users",
+ "entities": [
+ {
+ "uuid": "0e47f040-da71-11e0-b93d-12313f0204bb",
+ "type": "user",
+ "username": "john.doe",
+ "email": "john.doe@gmail.com",
+ "created": 1315523992687007,
+ "modified": 1315523992687007,
+ "metadata": {
+ "path": "/users/0e47f040-da71-11e0-b93d-12313f0204bb",
+ "collections": {
+ "activities": "/users/0e47f040-da71-11e0-b93d-12313f0204bb/activities",
+ "feed": "/users/0e47f040-da71-11e0-b93d-12313f0204bb/feed",
+ "groups": "/users/0e47f040-da71-11e0-b93d-12313f0204bb/groups",
+ "messages": "/users/0e47f040-da71-11e0-b93d-12313f0204bb/messages",
+ "queue": "/users/0e47f040-da71-11e0-b93d-12313f0204bb/queue",
+ "roles": "/users/0e47f040-da71-11e0-b93d-12313f0204bb/roles",
+ "following": "/users/0e47f040-da71-11e0-b93d-12313f0204bb/following",
+ "followers": "/users/0e47f040-da71-11e0-b93d-12313f0204bb/followers"
+ },
+ "sets": {
+ "rolenames": "/users/0e47f040-da71-11e0-b93d-12313f0204bb/rolenames",
+ "permissions": "/users/0e47f040-da71-11e0-b93d-12313f0204bb/permissions"
+ }
+ }
+ }
+ ],
+ "timestamp": 1315523992585,
+ "duration": 162
+ }
+ >
+
+Enter the following to create another user:
+
+ post /users {"username":"jane.doe","email":"jane.doe@gmail.com"}
+
+You should see something like the following result:
+
+ > post /users {"username":"jane.doe","email":"jane.doe@gmail.com"}
+ /users
+ {
+ "action": "post",
+ "application": "1c8f60e4-da67-11e0-b93d-12313f0204bb",
+ "params": {},
+ "path": "/users",
+ "uri": "https://api.usergrid.com/1c8f60e4-da67-11e0-b93d-12313f0204bb/users",
+ "entities": [
+ {
+ "uuid": "78c54a82-da71-11e0-b93d-12313f0204bb",
+ "type": "user",
+ "username": "jane.doe",
+ "email": "jane.doe@gmail.com",
+ "created": 1315524171347008,
+ "modified": 1315524171347008,
+ "metadata": {
+ "path": "/users/78c54a82-da71-11e0-b93d-12313f0204bb",
+ "collections": {
+ "activities": "/users/78c54a82-da71-11e0-b93d-12313f0204bb/activities",
+ "feed": "/users/78c54a82-da71-11e0-b93d-12313f0204bb/feed",
+ "groups": "/users/78c54a82-da71-11e0-b93d-12313f0204bb/groups",
+ "messages": "/users/78c54a82-da71-11e0-b93d-12313f0204bb/messages",
+ "queue": "/users/78c54a82-da71-11e0-b93d-12313f0204bb/queue",
+ "roles": "/users/78c54a82-da71-11e0-b93d-12313f0204bb/roles",
+ "following": "/users/78c54a82-da71-11e0-b93d-12313f0204bb/following",
+ "followers": "/users/78c54a82-da71-11e0-b93d-12313f0204bb/followers"
+ },
+ "sets": {
+ "rolenames": "/users/78c54a82-da71-11e0-b93d-12313f0204bb/rolenames",
+ "permissions": "/users/78c54a82-da71-11e0-b93d-12313f0204bb/permissions"
+ }
+ }
+ }
+ ],
+ "timestamp": 1315524171329,
+ "duration": 110
+ }
+ >
+
+Now enter the command to list the elements of the users collection
+again:
+
+ /users
+
+This time the results should show the two users you added:
+
+ > /users
+ /users
+ {
+ "action": "get",
+ "application": "1c8f60e4-da67-11e0-b93d-12313f0204bb",
+ "params": {
+ "_": [
+ "1315524221412"
+ ]
+ },
+ "path": "/users",
+ "uri": "https://api.usergrid.com/1c8f60e4-da67-11e0-b93d-12313f0204bb/users",
+ "entities": [
+ {
+ "uuid": "0e47f040-da71-11e0-b93d-12313f0204bb",
+ "type": "user",
+ "created": 1315523992687007,
+ "modified": 1315523992687007,
+ "email": "john.doe@gmail.com",
+ "metadata": {
+ "path": "/users/0e47f040-da71-11e0-b93d-12313f0204bb",
+ "collections": {
+ "activities": "/users/0e47f040-da71-11e0-b93d-12313f0204bb/activities",
+ "feed": "/users/0e47f040-da71-11e0-b93d-12313f0204bb/feed",
+ "groups": "/users/0e47f040-da71-11e0-b93d-12313f0204bb/groups",
+ "messages": "/users/0e47f040-da71-11e0-b93d-12313f0204bb/messages",
+ "queue": "/users/0e47f040-da71-11e0-b93d-12313f0204bb/queue",
+ "roles": "/users/0e47f040-da71-11e0-b93d-12313f0204bb/roles",
+ "following": "/users/0e47f040-da71-11e0-b93d-12313f0204bb/following",
+ "followers": "/users/0e47f040-da71-11e0-b93d-12313f0204bb/followers"
+ },
+ "sets": {
+ "rolenames": "/users/0e47f040-da71-11e0-b93d-12313f0204bb/rolenames",
+ "permissions": "/users/0e47f040-da71-11e0-b93d-12313f0204bb/permissions"
+ }
+ },
+ "username": "john.doe"
+ },
+ {
+ "uuid": "78c54a82-da71-11e0-b93d-12313f0204bb",
+ "type": "user",
+ "created": 1315524171347008,
+ "modified": 1315524171347008,
+ "email": "jane.doe@gmail.com",
+ "metadata": {
+ "path": "/users/78c54a82-da71-11e0-b93d-12313f0204bb",
+ "collections": {
+ "activities": "/users/78c54a82-da71-11e0-b93d-12313f0204bb/activities",
+ "feed": "/users/78c54a82-da71-11e0-b93d-12313f0204bb/feed",
+ "groups": "/users/78c54a82-da71-11e0-b93d-12313f0204bb/groups",
+ "messages": "/users/78c54a82-da71-11e0-b93d-12313f0204bb/messages",
+ "queue": "/users/78c54a82-da71-11e0-b93d-12313f0204bb/queue",
+ "roles": "/users/78c54a82-da71-11e0-b93d-12313f0204bb/roles",
+ "following": "/users/78c54a82-da71-11e0-b93d-12313f0204bb/following",
+ "followers": "/users/78c54a82-da71-11e0-b93d-12313f0204bb/followers"
+ },
+ "sets": {
+ "rolenames": "/users/78c54a82-da71-11e0-b93d-12313f0204bb/rolenames",
+ "permissions": "/users/78c54a82-da71-11e0-b93d-12313f0204bb/permissions"
+ }
+ },
+ "username": "jane.doe"
+ }
+ ],
+ "timestamp": 1315524225021,
+ "duration": 59
+ }
+ >
+
+To retrieve a specific user, try the following:
+
+ /users/jane.doe
+
+You should see results similar to this:
+
+ > /users/jane.doe
+ /users/jane.doe
+ {
+ "action": "get",
+ "application": "1c8f60e4-da67-11e0-b93d-12313f0204bb",
+ "params": {
+ "_": [
+ "1315524419746"
+ ]
+ },
+ "path": "/users",
+ "uri": "https://api.usergrid.com/1c8f60e4-da67-11e0-b93d-12313f0204bb/users",
+ "entities": [
+ {
+ "uuid": "78c54a82-da71-11e0-b93d-12313f0204bb",
+ "type": "user",
+ "created": 1315524171347008,
+ "modified": 1315524171347008,
+ "email": "jane.doe@gmail.com",
+ "metadata": {
+ "path": "/users/78c54a82-da71-11e0-b93d-12313f0204bb",
+ "collections": {
+ "activities": "/users/78c54a82-da71-11e0-b93d-12313f0204bb/activities",
+ "feed": "/users/78c54a82-da71-11e0-b93d-12313f0204bb/feed",
+ "groups": "/users/78c54a82-da71-11e0-b93d-12313f0204bb/groups",
+ "messages": "/users/78c54a82-da71-11e0-b93d-12313f0204bb/messages",
+ "queue": "/users/78c54a82-da71-11e0-b93d-12313f0204bb/queue",
+ "roles": "/users/78c54a82-da71-11e0-b93d-12313f0204bb/roles",
+ "following": "/users/78c54a82-da71-11e0-b93d-12313f0204bb/following",
+ "followers": "/users/78c54a82-da71-11e0-b93d-12313f0204bb/followers"
+ },
+ "sets": {
+ "rolenames": "/users/78c54a82-da71-11e0-b93d-12313f0204bb/rolenames",
+ "permissions": "/users/78c54a82-da71-11e0-b93d-12313f0204bb/permissions"
+ }
+ },
+ "username": "jane.doe"
+ }
+ ],
+ "timestamp": 1315524421071,
+ "duration": 107
+ }
+ >
+
+### Adding properties using the shell
+
+Now, let's add some information (entity properties) for the user
+jane.doe. You can assign application-specific or system-defined
+properties to user entities. (See the You do not have access to view
+this node for a list of predefined properties for each system-defined
+entity type.) As an example of adding an application-specific property,
+let's add the property city to the user jane.doe by typing:
+
+ put /users/jane.doe {"city" : "san francisco" }
+
+You should see results similar to this:
+
+ > put /users/jane.doe {"city" : "san francisco" }
+ /users/jane.doe
+ {
+ "action": "put",
+ "application": "1c8f60e4-da67-11e0-b93d-12313f0204bb",
+ "params": {},
+ "path": "/users",
+ "uri": "https://api.usergrid.com/1c8f60e4-da67-11e0-b93d-12313f0204bb/users",
+ "entities": [
+ {
+ "uuid": "78c54a82-da71-11e0-b93d-12313f0204bb",
+ "type": "user",
+ "created": 1315524171347008,
+ "modified": 1315524526405008,
+ "city": "san francisco",
+ "email": "jane.doe@gmail.com",
+ "metadata": {
+ "path": "/users/78c54a82-da71-11e0-b93d-12313f0204bb",
+ "collections": {
+ "activities": "/users/78c54a82-da71-11e0-b93d-12313f0204bb/activities",
+ "feed": "/users/78c54a82-da71-11e0-b93d-12313f0204bb/feed",
+ "groups": "/users/78c54a82-da71-11e0-b93d-12313f0204bb/groups",
+ "messages": "/users/78c54a82-da71-11e0-b93d-12313f0204bb/messages",
+ "queue": "/users/78c54a82-da71-11e0-b93d-12313f0204bb/queue",
+ "roles": "/users/78c54a82-da71-11e0-b93d-12313f0204bb/roles",
+ "following": "/users/78c54a82-da71-11e0-b93d-12313f0204bb/following",
+ "followers": "/users/78c54a82-da71-11e0-b93d-12313f0204bb/followers"
+ },
+ "sets": {
+ "rolenames": "/users/78c54a82-da71-11e0-b93d-12313f0204bb/rolenames",
+ "permissions": "/users/78c54a82-da71-11e0-b93d-12313f0204bb/permissions"
+ }
+ },
+ "username": "jane.doe"
+ }
+ ],
+ "timestamp": 1315524526343,
+ "duration": 84
+ }
+ >
+
+Let's create another type of object. Type the following:
+
+ post /cats {"name" : "felix"}
+
+You should see results for the collection cats that you created with the
+entity felix:
+
+ > post /cats {"name" : "felix"}
+ /cats
+ {
+ "action": "post",
+ "application": "1c8f60e4-da67-11e0-b93d-12313f0204bb",
+ "params": {},
+ "path": "/cats",
+ "uri": "https://api.usergrid.com/1c8f60e4-da67-11e0-b93d-12313f0204bb/cats",
+ "entities": [
+ {
+ "uuid": "89a05d85-da72-11e0-b93d-12313f0204bb",
+ "type": "cat",
+ "created": 1315524629123008,
+ "modified": 1315524629123008,
+ "metadata": {
+ "path": "/cats/89a05d85-da72-11e0-b93d-12313f0204bb"
+ },
+ "name": "felix"
+ }
+ ],
+ "timestamp": 1315524629068,
+ "duration": 107
+ }
+ >
+
+Now let's update this object by assigning a property color:
+
+ put /cats/felix {"color" : "black"}
+
+You should see something like the following results:
+
+ > put /cats/felix {"color" : "black"}
+ /cats/felix
+ {
+ "action": "put",
+ "application": "1c8f60e4-da67-11e0-b93d-12313f0204bb",
+ "params": {},
+ "path": "/cats",
+ "uri": "https://api.usergrid.com/1c8f60e4-da67-11e0-b93d-12313f0204bb/cats",
+ "entities": [
+ {
+ "uuid": "89a05d85-da72-11e0-b93d-12313f0204bb",
+ "type": "cat",
+ "created": 1315524629123008,
+ "modified": 1315524724093008,
+ "color": "black",
+ "metadata": {
+ "path": "/cats/89a05d85-da72-11e0-b93d-12313f0204bb"
+ },
+ "name": "felix"
+ }
+ ],
+ "timestamp": 1315524724058,
+ "duration": 57
+ }
+ >
+
+You can now click the Collections button in the sidebar to see all of
+the collections in your application. There are two entities in the users
+collection and one in the cats collection. Feel free to look around and
+see how the portal provides a high-level alternative to the API for
+viewing and manipulating application objects.
+
+Subsequent sections give details about using the API to access and
+modify application entities. If you're ready to start using the App
+services API, see the You do not have access to view this node for
+details and examples for each API endpoint.
+
+Analytics
+---------
+
+On the left sidebar, click Analytics to explore this functionality. You
+can specify parameters for data collection, including what data points
+you'd like to collect, over what time period, and at what resolution.
+When you click the Generate button, the results are displayed in tabular
+form and graphically in the lower portion of the window.
+
+Creating a sandbox app
+----------------------
+
+When you create a new Apache Usergrid account, an app named sandbox is
+automatically created. In some cases you may want to create (or
+re-create) the sandbox app. For example, you may want to create a
+sandbox app for another organization or you may want to create another
+app for testing purposes. See [Using a Sandbox
+Application](/using-sandbox-application) for details.
+
+Displaying API calls as cURL commands
+-------------------------------------
+
+You can display the equivalent cURL syntax for each API call that you
+make through the admin portal. The calls are displayed in the console
+area of any of the following browsers: Chrome, Internet Explorer (in the
+debugger), Firefox (in Firebug), and Safari. For details, see
+[Displaying Apache Usergrid API calls as Curl
+commands](/displaying-app-services-api-calls-curl-commands).