usergrid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From timangl...@apache.org
Subject svn commit: r1542910 [27/36] - in /incubator/usergrid/site/publish: ./ bootstrap/ bootstrap/bootstrap/ community/ css/ css/bootflat-extensions/ css/bootflat-square/ css/bootflat/ css/font-awesome/ css/usergrid-site/ docs/ docs/access-token/ docs/activi...
Date Mon, 18 Nov 2013 06:09:27 GMT
Added: incubator/usergrid/site/publish/docs/updating-data-entities/index.html
URL: http://svn.apache.org/viewvc/incubator/usergrid/site/publish/docs/updating-data-entities/index.html?rev=1542910&view=auto
==============================================================================
--- incubator/usergrid/site/publish/docs/updating-data-entities/index.html (added)
+++ incubator/usergrid/site/publish/docs/updating-data-entities/index.html Mon Nov 18 06:09:23 2013
@@ -0,0 +1,1223 @@
+<!DOCTYPE html>
+<html lang="en">
+
+<head>
+    <meta charset="utf-8">
+    <title>Apache Usergrid (incubating) — Updating Data Entities</title>
+    <meta http-equiv="x-ua-compatible" content="ie=edge" />
+    <meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=1" />
+    <meta name="keywords" content="Apache Usergrid, Usergrid, BaaS, Backend-as-a-Service">
+    <meta name="description" content="An open-source Backend-as-a-Service stack for web & mobile applications, based on RESTful APIs." />
+    <meta property="og:title" content="Apache Usergrid" />
+    <meta property="og:description" content="An open-source Backend-as-a-Service stack for web & mobile applications, based on RESTful APIs." />
+    <!-- Loading Typekit -->
+    <script type="text/javascript" src="//use.typekit.net/ddl7izx.js"></script>
+    <script type="text/javascript">try{Typekit.load();}catch(e){}</script>
+    <!-- Loading Bootstrap -->
+    <link href="/bootstrap/bootstrap.min.css" rel="stylesheet" type='text/css'>
+    <link href="/css/bootflat.css" rel="stylesheet" type='text/css'>
+    <link href="/css/usergrid-site.css" rel="stylesheet" type='text/css'>
+    <link href="http://fonts.googleapis.com/css?family=Open+Sans:200,400,500,300,600,800,700,400italic,600italic,700italic,800italic,300italic" rel="stylesheet" type="text/css">
+    <link href="/css/font-awesome.min.css" rel="stylesheet" type='text/css'>
+
+    
+
+    <!-- HTML5 shim, for IE6-8 support of HTML5 elements. All other JS at the end of file. -->
+    <!--[if lt IE 9]>
+      <script src="js/html5shiv.js"></script>
+      <script src="js/respond.min.js"></script>
+    <![endif]-->
+</head>
+<body>
+
+    <header class="navbar navbar-inverse navbar-fixed-top bf-docs-nav secondary" role="banner">
+    <div class="container">
+        <div class="navbar-header">
+            <button class="navbar-toggle" type="button" data-toggle="collapse" data-target=".bf-navbar-collapse">
+                <span class="sr-only">Toggle navigation</span>
+                <span class="icon-bar"></span>
+                <span class="icon-bar"></span>
+                <span class="icon-bar"></span>
+            </button>
+            <a href="/" class="navbar-brand">
+                <img id="home-logo" src="/img/apache_usergrid_logo_white_small.png" />
+            </a>
+        </div>
+        <nav class="collapse navbar-collapse bf-navbar-collapse" role="navigation">
+            <ul class="nav navbar-nav navbar-right">
+                <!--<li class="active"><a href="/docs/"><span class="icns icon-book"></span></a></li>-->
+                <li class=""><a href="/community/"><span class="icns icon-group"></span></a></li>
+                <li><a href="http://github.com/usergrid/usergrid" target="_blank"><span class="icns icon-github-sign"></span></a></li>
+                <!--<li><a href="https://trello.com/b/exQmJIOn/usergrid" target="_blank"><span class="icns icon-trello"></span></a></li>-->
+                <li><a href="https://issues.apache.org/jira/browse/USERGRID" target="_blank"><span class="icns icon-bug"></span></a></li>
+                <li><a href="http://stackoverflow.com/search?q=usergrid" target="_blank"><span class="icns icon-stackexchange"></span></a></li>
+                <li><a href="http://webchat.freenode.net/?channels=%23usergrid&uio=d4" target="_blank"><span class="icns icon-comments"></span></a></li>
+                <!--<li><a href="https://groups.google.com/forum/#!forum/usergrid" target="_blank"><span class="icns icon-envelope"></span></a></li>-->
+                <li><a href="https://twitter.com/usergrid" target="_blank"><span class="icns icon-twitter"></span></a></li>
+            </ul>
+        </nav>
+    </div>
+    </header>
+
+
+<div class="container bf-docs-container">    
+    <div class="row">
+        <div class="col-md-3">
+            <div class="bf-sidebar hidden-print" role="complementary">
+                <ul class="nav nav-list">
+                    <li><a href="#">Getting Up & Running Locally</a></li>
+                    <li><a href="#"><code>ugc</code> — the Command-line Client</a></li>
+
+                    <li class="nav-header"><span>Concepts</span></li>
+                    <li>
+                        <a href="/docs/organizations-admins/">Organizations & Admins</a>
+                        <ul>
+                            <li>
+                                <a href="/docs/applications">Applications</a>
+                                <ul>
+                                    <li><a href="#">Roles & Permissions</a></li>
+                                    <li><a href="#">Queues</a></li>
+                                    <li><a href="#">Events & Counters</a></li>
+                                    <li>
+                                        <a href="#">Collections</a>
+                                        <ul>
+                                            <li><a href="#">Query Language</a></li>
+                                            <li><a href="#">Users & Devices</a></li>
+                                            <li><a href="#">Groups</a></li>
+                                            <li><a href="#">Activities</a></li>
+                                            <li><a href="#">Assets</a></li>
+                                        </ul>
+                                    </li>
+                                </ul>
+                            </li>
+                        </ul>
+                    </li>
+
+
+                    <li class="nav-header"><span>Usage</span></li>
+                    <li><a href="/docs/rest-api">REST API</a></li>
+                    <li><a class="icns-apple" href="#">iOS SDK</a></li>
+                    <li><a class="icns-android" href="#">Android SDK</a></li>
+                    <li><a class="icns-html5" href="/docs/html5-javascript-sdk">HTML5 / JavaScript SDK</a></li>
+                    <li><a class="icns-windows" href="#">Windows 8 / Windows Phone / .net SDK</a></li>
+                    <li><a href="/docs/nodejs-module">Node.js module</a></li>
+                    <li><a href="/docs/ruby-gem">Ruby gem</a></li>
+                    <li><a href="#">Ruby on Rails gem</a></li>
+                    <li><a href="#">PHP library</a></li>
+
+                    <li class="nav-header"><span>Internals</span></li>
+                    <li><a href="#">Design & Goals</a></li>
+                    <li><a href="#">Java Architecture</a></li>
+                    <li><a href="#">Cassandra Schema</a></li>
+                    <li><a href="#">Contributing</a></li>
+
+                    <li class="nav-header"><span>Operations</span></li>
+                    <li><a href="#">Deploying</a></li>
+                    <li><a href="#">Monitoring</a></li>
+                    <li><a href="#">Upgrading</a></li>
+                    <li><a href="#">Security</a></li>
+                </ul>
+            </div>
+        </div>
+
+        <div class="col-md-9 main-article" role="main">
+            <div class="page-article">
+                <div class="page-header">
+                    <h1>Updating Data Entities</h1>
+                  <small><a href="https://github.com/timanglade/usergrid-site/blob/master/content/docs/updating-data-entities/">contribute to this article on github</a></small>
+                </div>
+                <div class="toc">
+	<ul>
+<li>
+<a href="#updating-data-entities">Updating Data Entities</a><ul>
+<li>
+<a href="#updating-an-entity">Updating an entity</a><ul>
+<li><a href="#example-requestresponse">Example Request/Response</a></li>
+<li><a href="#request-syntax">Request Syntax</a></li>
+<li><a href="#parameters">Parameters</a></li>
+<li><a href="#example-requestresponse-1">Example Request/Response</a></li>
+<li><a href="#sdk-method">SDK Method</a></li>
+<li><a href="#parameters-1">Parameters</a></li>
+<li><a href="#example-requestresponse-2">Example Request/Response</a></li>
+<li><a href="#sdk-method-1">SDK Method</a></li>
+<li><a href="#parameters-2">Parameters</a></li>
+<li><a href="#example-requestresponse-3">Example Request/Response</a></li>
+<li><a href="#sdk-method-2">SDK Method</a></li>
+<li><a href="#example-requestresponse-4">Example Request/Response</a></li>
+<li><a href="#sdk-method-3">SDK Method</a></li>
+<li><a href="#example-requestresponse-5">Example Request/Response</a></li>
+<li><a href="#example---response">Example - Response</a></li>
+<li><a href="#sdk-method-4">SDK Method</a></li>
+</ul>
+</li>
+<li>
+<a href="#updating-a-sub-property">Updating a sub-property</a><ul>
+<li><a href="#example-requestresponse-6">Example Request/Response</a></li>
+<li><a href="#request-syntax-1">Request Syntax</a></li>
+<li><a href="#parameters-3">Parameters</a></li>
+<li><a href="#example-requestresponse-7">Example Request/Response</a></li>
+<li><a href="#sdk-method-5">SDK Method</a></li>
+<li><a href="#parameters-4">Parameters</a></li>
+<li><a href="#example-requestresponse-8">Example Request/Response</a></li>
+<li><a href="#sdk-method-6">SDK Method</a></li>
+<li><a href="#parameters-5">Parameters</a></li>
+<li><a href="#example-requestresponse-9">Example Request/Response</a></li>
+<li><a href="#sdk-method-7">SDK Method</a></li>
+<li><a href="#example-requestresponse-10">Example Request/Response</a></li>
+<li><a href="#sdk-method-8">SDK Method</a></li>
+<li><a href="#example-requestresponse-11">Example Request/Response</a></li>
+<li><a href="#sdk-method-9">SDK Method</a></li>
+</ul>
+</li>
+</ul>
+</li>
+</ul>
+</div>
+<h1 id="updating-data-entities"><a href="#updating-data-entities">Updating Data Entities</a></h1>
+<p>This article describes how to update entities in your Apache Usergrid account.</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 href="/authenticating-users-and-application-clients">Authenticating users and application clients</a> for details.</p>
+<h2 id="updating-an-entity"><a href="#updating-an-entity">Updating an entity</a></h2>
+<p>One or more properties can be updated with a single PUT request. For information on updating sub-properties, see <a href="#update_nested">Updating sub-properties</a> below.</p>
+<ul>
+<li><a href="#curl_update_entity">cURL</a></li>
+<li><a href="#ios_update_entity">iOS</a></li>
+<li><a href="#android_update_entity">Android</a></li>
+<li><a href="#javascript_update_entity">JavaScript (HTML5)</a></li>
+<li><a href="#ruby_update_entity">Ruby</a></li>
+<li><a href="#nodejs_update_entity">Node.js</a></li>
+</ul><h3 id="example-requestresponse"><a href="#example-requestresponse">Example Request/Response</a></h3>
+<h4 id="request"><a href="#request">Request:</a></h4>
+<pre><code>curl -X PUT https://api.usergrid.com/your-org/your-app/items/milk -d '{"price":"4.00", "availability":"in-stock"}'</code></pre>
+<h4 id="response"><a href="#response">Response:</a></h4>
+<pre><code>{
+  "action" : "put",
+  "application" : "f34f4222-a166-11e2-a7f7-02e81adcf3d0",
+  "params" : { },
+  "path" : "/items",
+  "uri" : "http://api.usergrid.com/your-org/your-app/items",
+  "entities" : [ {
+    "uuid" : "5bb76bca-1657-11e3-903f-9ff6c621a7a4",
+    "type" : "item",
+    "name" : "milk",
+    "created" : 1378405020796,
+    "modified" : 1378505705077,
+    "availability" : "in-stock",
+    "metadata" : {
+      "path" : "/items/5bb76bca-1657-11e3-903f-9ff6c621a7a4"
+    },
+    "name" : "milk",
+    "price" : "4.00"
+  } ],
+  "timestamp" : 1378505705050,
+  "duration" : 87,
+  "organization" : "your-org",
+  "applicationName" : "your-app"
+}</code></pre>
+<h3 id="request-syntax"><a href="#request-syntax">Request Syntax</a></h3>
+<pre><code>curl -X PUT https://api.usergrid.com/&lt;org&gt;/&lt;app&gt;/&lt;collection&gt;/&lt;entity&gt; -d {&lt;property&gt;}</code></pre>
+<h3 id="parameters"><a href="#parameters">Parameters</a></h3>
+<table>
+<col width="50%">
+<col width="50%">
+<thead><tr class="header">
+<th align="left">Parameter</th>
+<th align="left">Description</th>
+</tr></thead>
+<tbody>
+<tr class="odd">
+<td align="left"><p>org</p></td>
+<td align="left"><p>Organization UUID or organization name</p></td>
+</tr>
+<tr class="even">
+<td align="left"><p>app</p></td>
+<td align="left"><p>Application UUID or application name</p></td>
+</tr>
+<tr class="odd">
+<td align="left"><p>collection</p></td>
+<td align="left"><p>Collection UUID or collection name</p></td>
+</tr>
+<tr class="even">
+<td align="left"><p>entity</p></td>
+<td align="left"><p>Entity UUID or entity name</p></td>
+</tr>
+<tr class="odd">
+<td align="left"><p>property</p></td>
+<td align="left">
+<p>An entity property to be updated, formatted as a key-value pair. For example:</p>
+<pre><code>{"property_1":"value_1", "proper</code></pre>
+<p>ty_2“:”value_2“,…}</p>
+</td>
+</tr>
+</tbody>
+</table><p>This example uses the <a href="/app-services-sdks#ios">Apache Usergrid iOS SDK</a>.</p>
+<h3 id="example-requestresponse-1"><a href="#example-requestresponse-1">Example Request/Response</a></h3>
+<h4 id="request-1"><a href="#request-1">Request:</a></h4>
+<pre><code>-(NSString*)updateEntity {
+
+    //UUID of the entity to be updated
+    NSString *entityID = @"f42752aa-08fe-11e3-8268-5bd5fa5f701f";
+    
+    //Create an entity object
+    NSMutableDictionary *updatedEntity = [[NSMutableDictionary alloc] init ];
+    
+    //Set entity properties to be updated
+    [updatedEntity setObject:@"item" forKey:@"type"]; //Required - entity type
+    [updatedEntity setObject:@"in-stock" forKey:@"availability"];
+    [updatedEntity setObject:@"4.00" forKey:@"price"];
+
+    //we recommend you call ApigeeClient from your AppDelegate. 
+    //for more information see the iOS SDK install guide: http://apigee.com/docs/app-services/content/installing-apigee-sdk-ios
+    //create an instance of AppDelegate
+    AppDelegate *appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
+    
+    //call createEntity to initiate the API call
+    ApigeeClientResponse *response = [appDelegate.dataClient updateEntity:entityID entity:updatedEntity];
+
+    @try {
+        
+       //success
+        
+    }
+    @catch (NSException * e) {
+        //fail
+    }
+    
+}
+                </code></pre>
+<h4 id="response-1"><a href="#response-1">Response:</a></h4>
+<pre><code>{
+  "action" : "put",
+  "application" : "f34f4222-a166-11e2-a7f7-02e81adcf3d0",
+  "params" : { },
+  "path" : "/items",
+  "uri" : "http://api.usergrid.com/your-org/your-app/items",
+  "entities" : [ {
+    "uuid" : "5bb76bca-1657-11e3-903f-9ff6c621a7a4",
+    "type" : "item",
+    "name" : "milk",
+    "created" : 1378405020796,
+    "modified" : 1378505705077,
+    "availability" : "in-stock",
+    "metadata" : {
+      "path" : "/items/5bb76bca-1657-11e3-903f-9ff6c621a7a4"
+    },
+    "name" : "milk",
+    "price" : "4.00"
+  } ],
+  "timestamp" : 1378505705050,
+  "duration" : 87,
+  "organization" : "your-org",
+  "applicationName" : "your-app"
+}</code></pre>
+<h3 id="sdk-method"><a href="#sdk-method">SDK Method</a></h3>
+<pre><code>(ApigeeClientResponse *)updateEntity: (NSString *)entityID entity:(NSDictionary *)updatedEntity</code></pre>
+<h3 id="parameters-1"><a href="#parameters-1">Parameters</a></h3>
+<table>
+<thead><tr class="header">
+<th align="left">Parameter</th>
+<th align="left">Description</th>
+</tr></thead>
+<tbody>
+<tr class="odd">
+<td align="left">entityID</td>
+<td align="left">UUID of the entity to be updated</td>
+</tr>
+<tr class="even">
+<td align="left">updatedEntity</td>
+<td align="left">NSMutableDictionary containing the properties to be updated</td>
+</tr>
+</tbody>
+</table><p>This example uses the <a href="/app-services-sdks#android">Apache Usergrid Android SDK</a>.</p>
+<h3 id="example-requestresponse-2"><a href="#example-requestresponse-2">Example Request/Response</a></h3>
+<h4 id="request-2"><a href="#request-2">Request:</a></h4>
+<pre><code>//Create client entity
+String ORGNAME = "your-org";
+String APPNAME = "your-app";        
+ApigeeClient apigeeClient = new ApigeeClient(ORGNAME,APPNAME);
+DataClient dataClient = apigeeClient.getDataClient();
+
+//Create properties object
+
+String entityID = "fd0def5a-091c-11e3-a60d-eb644ab154cc";
+
+Map&lt;String, Object&gt; updatedProperties = new HashMap&lt;String, Object&gt;();
+updatedProperties.put("type", "item"); //Required
+updatedProperties.put("availability", "in-stock");
+updatedProperties.put("price", "4.00");
+
+//call updateEntityAsync to initiate the asynchronous API call
+dataClient.updateEntityAsync(entityID, updatedProperties, new ApiResponseCallback() {   
+    
+    //If updateEntityAsync fails, catch the error
+    @Override
+    public void onException(Exception e) { 
+        // Error
+    }
+    
+    //If updateEntityAsync is successful, handle the response object
+    @Override
+    public void onResponse(ApiResponse response) {
+        try { 
+            if (response != null) {
+                // Success
+            }
+        } catch (Exception e) { //The API request returned an error
+                // Fail
+        }
+    }
+});
+                
+                </code></pre>
+<h4 id="response-2"><a href="#response-2">Response:</a></h4>
+<pre><code>{"action":"put","application":"f34f4222-a166-11e2-a7f7-02e81adcf3d0","entities":[{"dataClient":{"accessToken":null,"apiUrl":"https://api.usergrid.com","applicationId":"your-app","clientId":null,"clientSecret":null,"currentOrganization":null,"loggedInUser":null,"organizationId":"your-org"},"type":"item","uuid":"5bb76bca-1657-11e3-903f-9ff6c621a7a4","price":"4.00","created":1378405020796,"name":"milk","modified":1378748497900,"availability":"in-stock","metadata":{"path":"/items/5bb76bca-1657-11e3-903f-9ff6c621a7a4"}}],"params":{},"path":"/items","rawResponse":"{
+  "action" : "put",
+  "application" : "f34f4222-a166-11e2-a7f7-02e81adcf3d0",
+  "params" : { },
+  "path" : "/items",
+  "uri" : "http://api.usergrid.com/your-org/your-app/items",
+  "entities" : [ {
+    "uuid" : "5bb76bca-1657-11e3-903f-9ff6c621a7a4",
+    "type" : "item",
+    "name" : "milk",
+    "created" : 1378405020796,
+    "modified" : 1378748497900,
+    "availability" : "in-stock",
+    "metadata" : {
+      "path" : "/items/5bb76bca-1657-11e3-903f-9ff6c621a7a4"
+    },
+    "name" : "milk",
+    "price" : "4.00"
+  } ],
+  "timestamp" : 1378748497887,
+  "duration" : 80,
+  "organization" : "your-org",
+  "applicationName" : "your-app"
+}
+","uri":"http://api.usergrid.com/your-org/your-app/items","timestamp":1378748497887,"entityCount":1,"firstEntity":{"dataClient":{"accessToken":null,"apiUrl":"https://api.usergrid.com","applicationId":"your-app","clientId":null,"clientSecret":null,"currentOrganization":null,"loggedInUser":null,"organizationId":"your-org"},"type":"item","uuid":"5bb76bca-1657-11e3-903f-9ff6c621a7a4","price":"4.00","created":1378405020796,"name":"milk","modified":1378748497900,"availability":"in-stock","metadata":{"path":"/items/5bb76bca-1657-11e3-903f-9ff6c621a7a4"}},"lastEntity":{"dataClient":{"accessToken":null,"apiUrl":"https://api.usergrid.com","applicationId":"your-app","clientId":null,"clientSecret":null,"currentOrganization":null,"loggedInUser":null,"organizationId":"your-org"},"type":"item","uuid":"5bb76bca-1657-11e3-903f-9ff6c621a7a4","price":"4.00","created":1378405020796,"name":"milk","modified":1378748497900,"availability":"in-stock","metadata":{"path":"/items/5bb76bca-1657-11e3-903f-9ff6c6
 21a7a4"}},"organization":"your-org","duration":80,"applicationName":"your-app"}                
+                </code></pre>
+<h3 id="sdk-method-1"><a href="#sdk-method-1">SDK Method</a></h3>
+<p>Asynchronous:</p>
+<pre><code>updateEntityAsync(String entityID, Map&lt;String, Object&gt; updatedProperties, ApiResponseCallback callback)</code></pre>
+<p>Synchronous:</p>
+<pre><code>updateEntity(String entityID, Map&lt;String, Object&gt; updatedProperties)</code></pre>
+<h3 id="parameters-2"><a href="#parameters-2">Parameters</a></h3>
+<table>
+<thead><tr class="header">
+<th align="left">Parameter</th>
+<th align="left">Description</th>
+</tr></thead>
+<tbody>
+<tr class="odd">
+<td align="left">entityID</td>
+<td align="left">UUID of the entity to be updated</td>
+</tr>
+<tr class="even">
+<td align="left">updatedProperties</td>
+<td align="left">Map object containing the properties to be updated. A ‘type’ property is required.</td>
+</tr>
+<tr class="odd">
+<td align="left">callback</td>
+<td align="left">Callback function (Asynchronous calls only)</td>
+</tr>
+</tbody>
+</table><p>This example uses the <a href="/app-services-sdks#javascript">Apache Usergrid JavaScript (HTML5) SDK</a>.</p>
+<h3 id="example-requestresponse-3"><a href="#example-requestresponse-3">Example Request/Response</a></h3>
+<h4 id="request-3"><a href="#request-3">Request:</a></h4>
+<pre><code>//Create the Apache Usergrid client object
+var dataClient = new Usergrid.Client({
+    orgName:'your-org',
+    appName:'your-app'
+});
+
+//Specify the UUID of the entity to be updated
+//and the properties to be updated
+var properties = {
+    client:dataClient, //Required
+    data:{'type':'item',
+    uuid:'b3aad0a4-f322-11e2-a9c1-999e12039f87', //UUID of the entity to be updated is required
+    price:'4.00',
+    availability:'in-stock'
+    }
+};
+
+//Create a new entity object that contains the updated properties
+var entity = new Usergrid.Entity(properties);
+
+//Call Entity.save() to initiate the API PUT request
+entity.save(function (error,response) {
+
+    if (error) { 
+        //error
+    } else { 
+        //success
+    }
+
+});    
+                </code></pre>
+<h4 id="response-3"><a href="#response-3">Response:</a></h4>
+<pre><code>Object {action: "put", application: "f34f4222-a166-11e2-a7f7-02e81adcf3d0", params: Object, path: "/items", uri: "http://api.usergrid.com/your-org/your-app/items"…}
+action: "put"
+application: "f34f4222-a166-11e2-a7f7-02e8sd83f3d0"
+applicationName: "your-app"
+duration: 62
+entities: Array[1]
+0: Object
+created: 1374534114329
+metadata: Object
+modified: 1376693371847
+name: "milk"
+price: "4.00" //updated
+availability: "in-stock" //updated
+varieties: Array[3] //This property was already present 
+type: "item"
+uuid: "b3aad0a4-f322-11e2-a9c1-999e12039f87"
+varieties: Array[3]
+__proto__: Object
+length: 1
+__proto__: Array[0]
+organization: "your-org"
+params: Object
+path: "/items"
+timestamp: 1376693371836
+uri: "http://api.usergrid.com/your-org/your-app/items"              
+                </code></pre>
+<h3 id="sdk-method-2"><a href="#sdk-method-2">SDK Method</a></h3>
+<pre><code>Entity.save();</code></pre>
+<p>This example uses the <a href="/app-services-sdks#ruby">Apache Usergrid RubyGem</a>.</p>
+<h3 id="example-requestresponse-4"><a href="#example-requestresponse-4">Example Request/Response</a></h3>
+<h4 id="request-4"><a href="#request-4">Request:</a></h4>
+<pre><code>#Create a client object
+usergrid_api = 'https://api.usergrid.com'
+organization = 'your-org'
+application = 'your-app'
+
+client = Usergrid::Application.new "#{usergrid_api}/#{organization}/#{application}"
+
+begin
+
+    # Specify the name or uuid of the collection and entity to be updated
+    # and the entity properties to be updated
+    entity = client['item']['b3aad0a4-f322-11e2-a9c1-999e12039f87'].entity #entity object
+    entity.price = '4.00'
+    entity.availability = 'in-stock'
+    
+    # Call save to initiate the API PUT request
+    entity.save
+
+rescue
+
+    #fail
+
+end
+                </code></pre>
+<h4 id="response-4"><a href="#response-4">Response:</a></h4>
+<pre><code>{
+  "action" : "put",
+  "application" : "f34f4222-a166-11e2-a7f7-02e81adcf3d0",
+  "params" : { },
+  "path" : "/items",
+  "uri" : "http://api.usergrid.com/your-org/your-app/items",
+  "entities" : [ {
+    "uuid" : "5bb76bca-1657-11e3-903f-9ff6c621a7a4",
+    "type" : "item",
+    "name" : "milk",
+    "created" : 1378405020796,
+    "modified" : 1378505705077,
+    "availability" : "in-stock",
+    "metadata" : {
+      "path" : "/items/5bb76bca-1657-11e3-903f-9ff6c621a7a4"
+    },
+    "name" : "milk",
+    "price" : "4.00"
+  } ],
+  "timestamp" : 1378505705050,
+  "duration" : 87,
+  "organization" : "your-org",
+  "applicationName" : "your-app"
+}</code></pre>
+<h3 id="sdk-method-3"><a href="#sdk-method-3">SDK Method</a></h3>
+<pre><code>save</code></pre>
+<p>The example assumes use of the <a href="/app-services-sdks#nodejs">Apache Usergrid Node.js module</a>.</p>
+<h3 id="example-requestresponse-5"><a href="#example-requestresponse-5">Example Request/Response</a></h3>
+<h4 id="request-5"><a href="#request-5">Request:</a></h4>
+<pre><code>//Create the Apache Usergrid client object
+var dataClient = new Usergrid.client({
+    orgName:'your-org',
+    appName:'your-app'
+});
+
+//Specify the UUID of the entity to be updated
+//and the properties to be updated
+var properties = {
+    client:dataClient, //Required
+    data:{'type':'item',
+    uuid:'b3aad0a4-f322-11e2-a9c1-999e12039f87', //UUID of the entity to be updated is required
+    price:'4.00',
+    availability:'in-stock'
+    }
+};
+
+//Create a new entity object the contains the updated properties
+var entity = new Usergrid.entity(properties);
+
+//Call Entity.save() to initiate the API PUT request
+entity.save(function (error,response) {
+
+    if (error) { 
+        //error
+    } else { 
+        //success
+    }
+
+});             
+                </code></pre>
+<h3 id="example---response"><a href="#example---response">Example - Response</a></h3>
+<pre><code>{
+  "action" : "put",
+  "application" : "f34f4222-a166-11e2-a7f7-02e81adcf3d0",
+  "params" : { },
+  "path" : "/items",
+  "uri" : "http://api.usergrid.com/your-org/your-app/items",
+  "entities" : [ {
+    "uuid" : "b3aad0a4-f322-11e2-a9c1-999e12039f87",
+    "type" : "item",
+    "name" : "milk",
+    "created" : 1374534114329,
+    "modified" : 1376695962803,
+    "metadata" : {
+      "path" : "/items/b3aad0a4-f322-11e2-a9c1-999e12039f87"
+    },
+    "name" : "milk",
+    "price" : "4.00",
+    "availability" : "in-stock"
+  } ],
+  "timestamp" : 1376695962790,
+  "duration" : 144,
+  "organization" : "your-org",
+  "applicationName" : "your-app"
+}
+                </code></pre>
+<h3 id="sdk-method-4"><a href="#sdk-method-4">SDK Method</a></h3>
+<pre><code>Entity.save();</code></pre>
+<h2 id="updating-a-sub-property"><a href="#updating-a-sub-property">Updating a sub-property</a></h2>
+<p>Data entities may contain sets of sub-properties as nested JSON objects. Unlike normal entity properties, however, sub-properties cannot be updated individually. Updating a nested object will cause all sub-properties within it to be overwritten.</p>
+<p>For example, if you have a data entity with the following nested object:</p>
+<pre><code>"varieties": [
+    {
+      "name": "1%",
+      "price": "3.25",
+      "SKU": "0393847575533445"
+    },
+    {
+      "name": "whole",
+      "price": "3.85",
+      "SKU": "0393394956788445"
+    }
+]       
+        </code></pre>
+<p>and you send this update to Apache Usergrid:</p>
+<pre><code>"varieties": [
+    {
+      "name": "2%",
+      "price": "3.00",
+    },
+    {
+      "price": "4.00",
+    }
+]       
+        </code></pre>
+<p>this will be the resulting nested object:</p>
+<pre><code>"varieties": [
+    {
+      "name": "2%",
+      "price": "3.00",
+    },
+    {
+      "price": "4.00",
+    }
+]       
+        </code></pre>
+<ul>
+<li><a href="#curl_update_subproperty">cURL</a></li>
+<li><a href="#ios_update_subproperty">iOS</a></li>
+<li><a href="#android_update_subproperty">Android</a></li>
+<li><a href="#javascript_update_subproperty">JavaScript (HTML5)</a></li>
+<li><a href="#ruby_update_subproperty">Ruby</a></li>
+<li><a href="#nodejs_update_subproperty">Node.js</a></li>
+</ul><h3 id="example-requestresponse-6"><a href="#example-requestresponse-6">Example Request/Response</a></h3>
+<h4 id="request-6"><a href="#request-6">Request:</a></h4>
+<pre><code>curl -X PUT https://api.usergrid.com/your-org/your-app/items/milk -d '{"varieties":[{"name":"1%","price":"3.25"},{"name":"whole","price":"4.00"}]}'</code></pre>
+<h4 id="response-5"><a href="#response-5">Response:</a></h4>
+<pre><code>{
+  "action" : "put",
+  "application" : "f34f4222-a166-11e2-a7f7-02e81adcf3d0",
+  "params" : { },
+  "path" : "/items",
+  "uri" : "http://api.usergrid.com/your-org/your-app/items",
+  "entities" : [ {
+    "uuid" : "5bb76bca-1657-11e3-903f-9ff6c621a7a4",
+    "type" : "item",
+    "name" : "milk",
+    "created" : 1378405020796,
+    "modified" : 1378761459069,
+    "availability" : "in-stock",
+    "metadata" : {
+      "path" : "/items/5bb76bca-1657-11e3-903f-9ff6c621a7a4"
+    },
+    "name" : "milk",
+    "uri" : "http://api.usergrid.com/your-org/your-app/items/5bb76bca-1657-11e3-903f-9ff6c621a7a4",
+    "varieties" : [ {
+      "name" : "1%",
+      "price" : "3.25"
+    }, {
+      "name" : "whole",
+      "price" : "4.00"
+    } ]
+  } ],
+  "timestamp" : 1378761459047,
+  "duration" : 62,
+  "organization" : "your-org",
+  "applicationName" : "your-app"
+}</code></pre>
+<h3 id="request-syntax-1"><a href="#request-syntax-1">Request Syntax</a></h3>
+<pre><code>curl -X PUT https://api.usergrid.com/&lt;org_id&gt;/&lt;app_id&gt;/&lt;collection&gt;/&lt;uuid|name&gt; -d '{&lt;property&gt; : [{&lt;sub_property&gt;}, {&lt;sub_property&gt;}...]}'</code></pre>
+<h3 id="parameters-3"><a href="#parameters-3">Parameters</a></h3>
+<table>
+<col width="16%">
+<col width="81%">
+<thead><tr class="header">
+<th align="left">Parameter</th>
+<th align="left">Description</th>
+</tr></thead>
+<tbody>
+<tr class="odd">
+<td align="left">org_id</td>
+<td align="left">Organization UUID or organization name</td>
+</tr>
+<tr class="even">
+<td align="left">app_id</td>
+<td align="left">Application UUID or application name</td>
+</tr>
+<tr class="odd">
+<td align="left">collection</td>
+<td align="left">Name of the collection containing the entity to be updated</td>
+</tr>
+<tr class="even">
+<td align="left">uuid|name</td>
+<td align="left">UUID or name of the data entity to be updated</td>
+</tr>
+<tr class="odd">
+<td align="left">entity_property</td>
+<td align="left">The name of the entity property that contains the nested object to be updated</td>
+</tr>
+<tr class="even">
+<td align="left">sub_property</td>
+<td align="left">Entity properties of the nested object, as a set of key-value pairs in the format:<br><em>{&lt;property_name&gt; : &lt;property_value&gt;, &lt;property_name&gt; : &lt;property_value&gt; …}</em>
+</td>
+</tr>
+</tbody>
+</table><p>This example uses the <a href="/app-services-sdks#ios">Apache Usergrid iOS SDK</a>.</p>
+<h3 id="example-requestresponse-7"><a href="#example-requestresponse-7">Example Request/Response</a></h3>
+<h4 id="request-7"><a href="#request-7">Request:</a></h4>
+<pre><code>-(NSString*)updateEntity {
+
+    //UUID of the entity to be updated
+    NSString *entityID = @"f42752aa-08fe-11e3-8268-5bd5fa5f701f";
+        
+    //Define our two sub-properties to include in the update
+    NSMutableDictionary *subproperty1 = [[NSMutableDictionary alloc] init];
+    NSMutableDictionary *subproperty2 = [[NSMutableDictionary alloc] init];
+    [subproperty1 setObject:@"1%" forKey:@"name"];
+    [subproperty1 setObject:@"3.25" forKey:@"price"];
+    [subproperty2 setObject:@"whole" forKey:@"name"];
+    [subproperty2 setObject:@"4.00" forKey:@"price"];
+    
+    //Put our sub-properties into an NSArray
+    NSArray *subproperties = [[NSArray alloc] initWithObjects:props1,props2, nil];
+
+    //Create an NSMutableDictionary to hold our updates
+    NSMutableDictionary *updatedEntity = [[NSMutableDictionary alloc] init ];
+
+    //Set the properties to be updated
+    [updatedEntity setObject:@"item" forKey:@"type"]; //Required - entity type
+    [updatedEntity setObject:props forKey:@"varieties"];
+    
+    //we recommend you call ApigeeClient from your AppDelegate. 
+    //for more information see the iOS SDK install guide: http://apigee.com/docs/app-services/content/installing-apigee-sdk-ios
+    //create an instance of AppDelegate
+    AppDelegate *appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
+    
+    //call createEntity to initiate the API call
+    ApigeeClientResponse *response = [appDelegate.dataClient updateEntity:entityID entity:updatedEntity];
+
+    @try {
+        
+       //success
+        
+    }
+    @catch (NSException * e) {
+        //fail
+    }
+    
+}
+                </code></pre>
+<h4 id="response-6"><a href="#response-6">Response:</a></h4>
+<pre><code>{
+  "action" : "put",
+  "application" : "f34f4222-a166-11e2-a7f7-02e81adcf3d0",
+  "params" : { },
+  "path" : "/items",
+  "uri" : "http://api.usergrid.com/your-org/your-app/items",
+  "entities" : [ {
+    "uuid" : "5bb76bca-1657-11e3-903f-9ff6c621a7a4",
+    "type" : "item",
+    "name" : "milk",
+    "created" : 1378405020796,
+    "modified" : 1378761459069,
+    "availability" : "in-stock",
+    "metadata" : {
+      "path" : "/items/5bb76bca-1657-11e3-903f-9ff6c621a7a4"
+    },
+    "name" : "milk",
+    "uri" : "http://api.usergrid.com/your-org/your-app/items/5bb76bca-1657-11e3-903f-9ff6c621a7a4",
+    "varieties" : [ {
+      "name" : "1%",
+      "price" : "3.25"
+    }, {
+      "name" : "whole",
+      "price" : "4.00"
+    } ]
+  } ],
+  "timestamp" : 1378761459047,
+  "duration" : 62,
+  "organization" : "your-org",
+  "applicationName" : "your-app"
+}</code></pre>
+<h3 id="sdk-method-5"><a href="#sdk-method-5">SDK Method</a></h3>
+<pre><code>(ApigeeClientResponse *)updateEntity: (NSString *)entityID entity:(NSDictionary *)updatedEntity</code></pre>
+<h3 id="parameters-4"><a href="#parameters-4">Parameters</a></h3>
+<table>
+<thead><tr class="header">
+<th align="left">Parameter</th>
+<th align="left">Description</th>
+</tr></thead>
+<tbody>
+<tr class="odd">
+<td align="left">entityID</td>
+<td align="left">UUID of the entity to be updated</td>
+</tr>
+<tr class="even">
+<td align="left">updatedEntity</td>
+<td align="left">Entity object containing the properties to be updated</td>
+</tr>
+</tbody>
+</table><p>This example uses the <a href="/app-services-sdks#android">Apache Usergrid Android SDK</a>.</p>
+<h3 id="example-requestresponse-8"><a href="#example-requestresponse-8">Example Request/Response</a></h3>
+<h4 id="request-8"><a href="#request-8">Request:</a></h4>
+<pre><code>//Create client entity
+String ORGNAME = "your-org";
+String APPNAME = "your-app";        
+ApigeeClient apigeeClient = new ApigeeClient(ORGNAME,APPNAME);
+DataClient dataClient = apigeeClient.getDataClient();
+
+//UUID of the entity to be updated
+String entityID = "1ceed6ba-1b13-11e3-a7a6-59ffaee069e1";
+
+//The object we will pass to the API
+Map&lt;String,Object&gt; entityUpdates = new HashMap&lt;String,Object&gt;();
+
+//The objects we will need to setup the sub-properties
+ArrayList&lt;Map&lt;String,Object&gt;&gt; subPropertyArray = new ArrayList&lt;Map&lt;String,Object&gt;&gt;();
+Map&lt;String,Object&gt; subProperty1 = new HashMap&lt;String,Object&gt;();
+Map&lt;String,Object&gt; subProperty2 = new HashMap&lt;String,Object&gt;();
+
+//First sub-property
+subProperty1.put("name", "1%");
+subProperty2.put("price", "3.25");
+
+//Second sub-property
+subProperty2.put("name", "whole");
+subProperty2.put("price", "4.00");
+
+//Add the sub-properties to the List object
+subPropertyArray.add(subProperty1);
+subPropertyArray.add(subProperty2);
+
+//Now we put it all together
+entityUpdates.put("type", "item"); //Required
+entityUpdates.put("varieties", subPropertyArray);
+
+
+//call updateEntityAsync to initiate the asynchronous API call
+dataClient.updateEntityAsync(entityID, updatedProperties, new ApiResponseCallback() {   
+    
+    //If updateEntityAsync fails, catch the error
+    @Override
+    public void onException(Exception e) { 
+        // Error
+    }
+    
+    //If updateEntityAsync is successful, handle the response object
+    @Override
+    public void onResponse(ApiResponse response) {
+        try { 
+            if (response != null) {
+                // Success
+            }
+        } catch (Exception e) { //The API request returned an error
+                // Fail
+        }
+    }
+}); 
+                </code></pre>
+<h4 id="response-7"><a href="#response-7">Response:</a></h4>
+<pre><code>{"action":"put","application":"f34f4222-a166-11e2-a7f7-02e81adcf3d0","entities":[{"dataClient":{"accessToken":null,"apiUrl":"https://api.usergrid.com","applicationId":"your-app","clientId":null,"clientSecret":null,"currentOrganization":null,"loggedInUser":null,"organizationId":"your-org"},"type":"item","uuid":"1ceed6ba-1b13-11e3-a7a6-59ffaee069e1","varieties":[{"name":"1%","price":"3.25"},{"name":"whole","price":"4.00"}],"created":1378925465499,"name":"milk","modified":1378936578609,"metadata":{"path":"/items/1ceed6ba-1b13-11e3-a7a6-59ffaee069e1"}}],"params":{},"path":"/items","rawResponse":"{
+  "action" : "put",
+  "application" : "f34f4222-a166-11e2-a7f7-02e81adcf3d0",
+  "params" : { },
+  "path" : "/items",
+  "uri" : "http://api.usergrid.com/your-org/your-app/items",
+  "entities" : [ {
+    "uuid" : "1ceed6ba-1b13-11e3-a7a6-59ffaee069e1",
+    "type" : "item",
+    "name" : "milk",
+    "created" : 1378925465499,
+    "modified" : 1378936578609,
+    "metadata" : {
+      "path" : "/items/1ceed6ba-1b13-11e3-a7a6-59ffaee069e1"
+    },
+    "name" : "milk",
+    "varieties" : [ {
+      "name" : "1%",
+      "price" : "3.25"
+    }, {
+      "name" : "whole",
+      "price" : "4.00"
+    } ]
+  } ],
+  "timestamp" : 1378936578595,
+  "duration" : 75,
+  "organization" : "your-org",
+  "applicationName" : "your-app"
+}
+","uri":"http://api.usergrid.com/your-org/your-app/items","timestamp":1378936578595,"entityCount":1,"firstEntity":{"dataClient":{"accessToken":null,"apiUrl":"https://api.usergrid.com","applicationId":"your-app","clientId":null,"clientSecret":null,"currentOrganization":null,"loggedInUser":null,"organizationId":"your-org"},"type":"item","uuid":"1ceed6ba-1b13-11e3-a7a6-59ffaee069e1","varieties":[{"name":"1%","price":"3.25"},{"name":"whole","price":"4.00"}],"created":1378925465499,"name":"milk","modified":1378936578609,"metadata":{"path":"/items/1ceed6ba-1b13-11e3-a7a6-59ffaee069e1"}},"lastEntity":{"dataClient":{"accessToken":null,"apiUrl":"https://api.usergrid.com","applicationId":"your-app","clientId":null,"clientSecret":null,"currentOrganization":null,"loggedInUser":null,"organizationId":"your-org"},"type":"item","uuid":"1ceed6ba-1b13-11e3-a7a6-59ffaee069e1","varieties":[{"name":"1%","price":"3.25"},{"name":"whole","price":"4.00"}],"created":1378925465499,"name":"milk","modified":137
 8936578609,"metadata":{"path":"/items/1ceed6ba-1b13-11e3-a7a6-59ffaee069e1"}},"organization":"your-org","duration":75,"applicationName":"your-app"}
+                </code></pre>
+<h3 id="sdk-method-6"><a href="#sdk-method-6">SDK Method</a></h3>
+<p>Asynchronous:</p>
+<pre><code>updateEntityAsync(String entityID, Map&lt;String, Object&gt; updatedProperties, ApiResponseCallback callback)</code></pre>
+<p>Synchronous:</p>
+<pre><code>updateEntity(String entityID, Map&lt;String, Object&gt; updatedProperties)</code></pre>
+<h3 id="parameters-5"><a href="#parameters-5">Parameters</a></h3>
+<table>
+<thead><tr class="header">
+<th align="left">Parameter</th>
+<th align="left">Description</th>
+</tr></thead>
+<tbody>
+<tr class="odd">
+<td align="left">entityID</td>
+<td align="left">UUID of the entity to be updated</td>
+</tr>
+<tr class="even">
+<td align="left">updatedProperties</td>
+<td align="left">Map object containing the properties to be updated. A ‘type’ property is required.</td>
+</tr>
+<tr class="odd">
+<td align="left">callback</td>
+<td align="left">Callback function (Asynchronous calls only)</td>
+</tr>
+</tbody>
+</table><p>This example uses the <a href="/app-services-sdks#javascript">Apache Usergrid JavaScript (HTML5) SDK</a>.</p>
+<h3 id="example-requestresponse-9"><a href="#example-requestresponse-9">Example Request/Response</a></h3>
+<h4 id="request-9"><a href="#request-9">Request:</a></h4>
+<pre><code>//Create the Apache Usergrid client object
+var dataClient = new Usergrid.Client({
+    orgName:'your-org',
+    appName:'your-app'
+});
+
+//Specify the UUID of the entity to be updated
+//and the properties to be updated
+var properties = {
+    client:dataClient, //Required
+    data:{
+        type:'item',
+        uuid:'b151ddba-0921-11e3-9f60-2ba945ba461f',
+        varieties:[
+            {"name":"3%", "price":"3.25", "SKU":"9384752200033"},
+            {"name":"whole", "price":"4.00", "SKU":"9384752200033"}
+        ]
+    }
+};
+
+//Create a new entity object that contains the updated properties
+var entity = new Usergrid.Entity(properties);
+
+//Call Entity.save() to initiate the API PUT request
+entity.save(function (error,response) {
+
+    if (error) { 
+        //error
+    } else { 
+        //success
+    }
+
+});    
+                </code></pre>
+<h4 id="response-8"><a href="#response-8">Response:</a></h4>
+<pre><code>Object {action: "put", application: "f34f4222-a166-11e2-a7f7-02e81adcf3d0", params: Object, path: "/items", uri: "http://api.usergrid.com/your-org/your-app/items"…}
+action: "put"
+application: "f34f4222-a166-11e2-a7f7-02e81adcf3d0"
+applicationName: "your-app"
+duration: 66
+entities: Array[1]
+    0: Object
+    availability: "in-stock"
+    created: 1378405020796
+    metadata: Object
+    modified: 1378760239203
+    name: "milk"
+    price: "4.00"
+    type: "item"
+    uri: "http://api.usergrid.com/your-org/your-app/items/5bb76bca-1657-11e3-903f-9ff6c621a7a4"
+    uuid: "5bb76bca-1657-11e3-903f-9ff6c621a7a4"
+    varieties: Array[2]
+        0: Object
+            SKU: "9384752200033"
+            name: "3%"
+            price: "3.25"
+            __proto__: Object
+        1: Object
+            SKU: "9384752200033"
+            name: "whole"
+            price: "4.00"
+            __proto__: Object
+        length: 2
+        __proto__: Array[0]
+    __proto__: Object
+    length: 1
+__proto__: Array[0]
+organization: "your-org"
+params: Object
+path: "/items"
+timestamp: 1378760239191
+uri: "http://api.usergrid.com/your-org/your-app/items"
+__proto__: Object
+                </code></pre>
+<h3 id="sdk-method-7"><a href="#sdk-method-7">SDK Method</a></h3>
+<pre><code>Entity.save();</code></pre>
+<p>This example uses the <a href="/app-services-sdks#ruby">Apache Usergrid RubyGem</a>.</p>
+<h3 id="example-requestresponse-10"><a href="#example-requestresponse-10">Example Request/Response</a></h3>
+<h4 id="request-10"><a href="#request-10">Request:</a></h4>
+<pre><code>#Create a client object
+usergrid_api = 'https://api.usergrid.com'
+organization = 'your-org'
+application = 'your-app'
+
+client = Usergrid::Application.new "#{usergrid_api}/#{organization}/#{application}"
+
+begin
+
+    # Specify the name or uuid of the collection and entity to be updated
+    # and the entity properties to be updated
+    entity = client['item']['b3aad0a4-f322-11e2-a9c1-999e12039f87'].entity #entity object
+    entity.varieties = [
+            {
+                "name" =&gt; "1%",
+                "price" =&gt; "3.25",
+                "sku" =&gt; "0393847575533445"
+            },{
+                "name" =&gt; "whole",
+                "price" =&gt; "3.85",
+                "sku" =&gt; "0393394956788445"
+            }
+        ]
+    
+    # Call save to initiate the API PUT request
+    entity.save
+
+rescue
+
+    #fail
+
+end
+                </code></pre>
+<h4 id="response-9"><a href="#response-9">Response:</a></h4>
+<p>[[nid:11954]</p>
+<h3 id="sdk-method-8"><a href="#sdk-method-8">SDK Method</a></h3>
+<pre><code>save</code></pre>
+<p>This example uses the <a href="/app-services-sdks#nodejs">Apache Usergrid Node.js module</a>.</p>
+<h3 id="example-requestresponse-11"><a href="#example-requestresponse-11">Example Request/Response</a></h3>
+<h4 id="request-11"><a href="#request-11">Request:</a></h4>
+<pre><code>//Create the Apache Usergrid client object
+var dataClient = new Usergrid.client({
+    orgName:'your-org',
+    appName:'your-app'
+});
+
+//Specify the UUID of the entity to be updated
+//and the properties to be updated
+
+var properties = {
+    client:dataClient, //Required
+    data:{
+        type:'item',
+        uuid:'b3aad0a4-f322-11e2-a9c1-999e12039f87', //UUID of the entity to be updated is required
+        varieties : [
+            {
+                "name" : "1%",
+                "price" : "3.25",
+                "sku" : "0393847575533445"
+            },{
+                "name" : "whole",
+                "price" : "3.85",
+                "sku" : "0393394956788445"
+            },{
+                "name" : "skim",
+                "price" : "4.00",
+                "sku" : "0390299933488445"      
+            }
+        ]           
+    }
+};
+
+//Create a new entity object the contains the updated properties
+var entity = new Usergrid.entity(properties);
+
+//Call Entity.save() to initiate the API PUT request
+entity.save(function (error,response) {
+
+    if (error) { 
+        //error
+    } else { 
+        //success
+    }
+
+});             
+            </code></pre>
+<h4 id="response-10"><a href="#response-10">Response:</a></h4>
+<pre><code>{ action: 'put',
+  application: 'f34f4222-a166-11e2-a7f7-02e81adcf3d0',
+  params: {},
+  path: '/items',
+  uri: 'http://api.usergrid.com/your-org/your-app/items',
+  entities: 
+   [ { uuid: 'b3aad0a4-f322-11e2-a9c1-999e12039f87',
+       type: 'item',
+       created: 1374534114329,
+       modified: 1377039726738,
+       metadata: [Object],
+       varieties: [Object] } ],
+  timestamp: 1377039726724,
+  duration: 75,
+  organization: 'your-org',
+  applicationName: 'your-app' }
+            </code></pre>
+<h3 id="sdk-method-9"><a href="#sdk-method-9">SDK Method</a></h3>
+<pre><code>Entity.save();</code></pre>
+            </div>
+        </div>
+    </div>
+    <div class="row">
+        <div class="col-md-3"></div>
+        <div class="col-md-9">
+            <div class="github-callout">
+                <strong>Questions?</strong> Please do <a href="https://groups.google.com/forum/#!forum/usergrid">ask on the mailing-list</a>!<br/>
+                <strong>Found an error?</strong> We’d greatly appreciate a pull request about <a href="https://github.com/timanglade/usergrid-site/blob/master/content/docs/updating-data-entities/">this article on github</a>.</div>
+        </div>
+    </div>
+</div>
+
+
+<footer class="bf-footer" role="contentinfo">
+    <div class="container">
+        <div class="row">
+            <div class="col-md-2">
+                <ul class="nav nav-list">
+                    <li class="nav-header"><a href="/">Home</a></li>
+                    <li class="nav-header"><a href="/community/">Community</a></li>
+                        <!-- <li><a href="/community#events">Events</a></li> -->
+                        <li><a href="/community/#mailing-lists">Mailing Lists</a></li>
+                        <li><a href="/community/#deployments">Deployments</a></li>
+                        <li><a href="/community/#committers">Commiters</a></li>
+                    <!-- <li class="nav-header"><a href="#">Docs</a></li> -->
+                </ul>
+            </div>
+            <div class="col-md-2">
+                <ul class="nav nav-list">
+                    <li class="nav-header"><a href="https://github.com/usergrid/usergrid/" target="_blank">Code</a></li>
+                    <li><a href="https://github.com/usergrid/usergrid/blob/master/stack" target="_blank">Server Stack</a></li>
+                    <li><a href="https://github.com/usergrid/usergrid/blob/master/portal" target="_blank">Admin Portal</a></li>
+                    <li><a href="https://github.com/usergrid/usergrid/blob/master/ugc" target="_blank">ugc command line</a></li>
+                    <li><a href="https://github.com/usergrid/usergrid/blob/master/sdks/ios" target="_blank">iOS SDK</a></li>
+                    <li><a href="https://github.com/usergrid/usergrid/blob/master/sdks/android" target="_blank">Android SDK</a></li>
+                    <li><a href="https://github.com/usergrid/usergrid/blob/master/sdks/html5-javascript" target="_blank">HTML5/JS SDK</a></li>
+                    <li><a href="https://github.com/usergrid/usergrid/blob/master/sdks/nodejs" target="_blank">node.js module</a></li>
+                    <li><a href="https://github.com/usergrid/usergrid/blob/master/sdks/ruby-on-rails" target="_blank">Ruby on Rails gem</a></li>
+                    <li><a href="https://github.com/usergrid/usergrid/blob/master/sdks/ruby" target="_blank">Ruby gem</a></li>
+                    <li><a href="https://github.com/usergrid/usergrid/blob/master/sdks/php" target="_blank">PHP SDK</a></li>
+                    <li><a href="https://github.com/usergrid/usergrid/blob/master/sdks/java" target="_blank">Java SDK</a></li>
+                    <li><a href="https://github.com/usergrid/usergrid/blob/master/sdks/dotnet" target="_blank">.NET / Windows SDK</a></li>
+                </ul>
+            </div>
+            <div class="col-md-2">
+                <ul class="nav nav-list">
+                    <li class="nav-header">Resources</li>
+                        <li><a href="http://github.com/usergrid/usergrid" target="_blank">GitHub Code</a></li>
+                        <li><a href="https://issues.apache.org/jira/browse/USERGRID" target="_blank">JIRA Bug Tracker</a></li>
+                        <li><a href="http://stackoverflow.com/search?q=usergrid" target="_blank">StackOverflow</a></li>
+                        <li><a href="http://webchat.freenode.net/?channels=%23usergrid&uio=d4">IRC</a></li>
+                        <li><a href="https://twitter.com/usergrid" target="_blank">Twitter</a></li>
+                        <li><a href="http://incubator.apache.org/projects/usergrid.html" target="_blank">Podling Listing</a></li>
+                        <li><a href="https://github.com/usergrid/usergrid/blob/master/LICENSE" target="_blank">License</a></li>
+                        <li><a href="https://github.com/usergrid/usergrid/blob/master/stack#requirements" target="_blank">Getting Started</a></li>
+                        <li><a href="https://github.com/usergrid/usergrid/blob/master/stack#contributing" target="_blank">Contribution Guidelines</a></li>
+                </ul>
+            </div>
+            <div class="col-md-2"></div>
+            <div class="col-md-4">
+                <a class="twitter-timeline" href="https://twitter.com/search?q=%23usergrid" data-widget-id="401499136807038976"  data-related="usergrid" height="400px" style="overflow:hidden">Tweets about "usergrid"</a>
+                <script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+"://platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script>
+            </div> 
+        <!--
+            <div class="col-md-4">
+                <div class="input-group form-search">
+                    <input type="text" class="form-control search-query">
+                    <span class="input-group-btn">
+                        <button type="submit" class="btn btn-primary" data-type="last">Search</button>
+                    </span>
+                </div>
+            </div> -->
+        </div> 
+        <div class="row">
+            <div id="copyright">
+                <img src="/img/egg-logo.png" /><br/><br/>
+                <p>Apache Usergrid is an effort undergoing incubation at The Apache Software Foundation (ASF), sponsored by the name of Apache TLP sponsor. Incubation is required of all newly accepted projects until a further review indicates that the infrastructure, communications, and decision making process have stabilized in a manner consistent with other successful ASF projects. While incubation status is not necessarily a reflection of the completeness or stability of the code, it does indicate that the project has yet to be fully endorsed by the ASF.</p>
+                <p>Copyright © 2013 The Apache Software Foundation, Licensed under the Apache License, Version 2.0.<br>
+                Apache and the Apache feather logos are trademarks of The Apache Software Foundation.</p>
+                <p class="credits">Site designed & assembled with love by <a href="https://github.com/ryuneeee">@ryuneeee</a> + <a href="https://github.com/realbeast">@realbeast</a> + <a href="https://twitter.com/timanglade">@timanglade</a>.</p>
+            </div>
+        </div>
+    </div>
+</footer>
+
+<script type="text/javascript" src="/js/head.js"></script>
+<script type="text/javascript">
+    head.js("/js/jquery-1.10.1.min.js", "/js/bootstrap.min.js", "/js/usergrid-site.js");
+</script>
+<script type="text/javascript">
+    //IE outdate friendly warning if you don't want remove it
+    var $buoop = {vs:{i:8,f:3.6,o:10.6,s:3.2,n:9}}
+    $buoop.ol = window.onload;
+    window.onload=function(){
+        try {if ($buoop.ol) $buoop.ol();}catch (e) {}
+        var e = document.createElement("script");
+        e.setAttribute("type", "text/javascript");
+        e.setAttribute("src", "http://browser-update.org/update.js");
+        document.body.appendChild(e);
+    }
+</script>
+
+
+</body>
+</html>
\ No newline at end of file

Added: incubator/usergrid/site/publish/docs/uploading-files-and-assets/index.html
URL: http://svn.apache.org/viewvc/incubator/usergrid/site/publish/docs/uploading-files-and-assets/index.html?rev=1542910&view=auto
==============================================================================
--- incubator/usergrid/site/publish/docs/uploading-files-and-assets/index.html (added)
+++ incubator/usergrid/site/publish/docs/uploading-files-and-assets/index.html Mon Nov 18 06:09:23 2013
@@ -0,0 +1,409 @@
+<!DOCTYPE html>
+<html lang="en">
+
+<head>
+    <meta charset="utf-8">
+    <title>Apache Usergrid (incubating) — Uploading files and assets</title>
+    <meta http-equiv="x-ua-compatible" content="ie=edge" />
+    <meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=1" />
+    <meta name="keywords" content="Apache Usergrid, Usergrid, BaaS, Backend-as-a-Service">
+    <meta name="description" content="An open-source Backend-as-a-Service stack for web & mobile applications, based on RESTful APIs." />
+    <meta property="og:title" content="Apache Usergrid" />
+    <meta property="og:description" content="An open-source Backend-as-a-Service stack for web & mobile applications, based on RESTful APIs." />
+    <!-- Loading Typekit -->
+    <script type="text/javascript" src="//use.typekit.net/ddl7izx.js"></script>
+    <script type="text/javascript">try{Typekit.load();}catch(e){}</script>
+    <!-- Loading Bootstrap -->
+    <link href="/bootstrap/bootstrap.min.css" rel="stylesheet" type='text/css'>
+    <link href="/css/bootflat.css" rel="stylesheet" type='text/css'>
+    <link href="/css/usergrid-site.css" rel="stylesheet" type='text/css'>
+    <link href="http://fonts.googleapis.com/css?family=Open+Sans:200,400,500,300,600,800,700,400italic,600italic,700italic,800italic,300italic" rel="stylesheet" type="text/css">
+    <link href="/css/font-awesome.min.css" rel="stylesheet" type='text/css'>
+
+    
+
+    <!-- HTML5 shim, for IE6-8 support of HTML5 elements. All other JS at the end of file. -->
+    <!--[if lt IE 9]>
+      <script src="js/html5shiv.js"></script>
+      <script src="js/respond.min.js"></script>
+    <![endif]-->
+</head>
+<body>
+
+    <header class="navbar navbar-inverse navbar-fixed-top bf-docs-nav secondary" role="banner">
+    <div class="container">
+        <div class="navbar-header">
+            <button class="navbar-toggle" type="button" data-toggle="collapse" data-target=".bf-navbar-collapse">
+                <span class="sr-only">Toggle navigation</span>
+                <span class="icon-bar"></span>
+                <span class="icon-bar"></span>
+                <span class="icon-bar"></span>
+            </button>
+            <a href="/" class="navbar-brand">
+                <img id="home-logo" src="/img/apache_usergrid_logo_white_small.png" />
+            </a>
+        </div>
+        <nav class="collapse navbar-collapse bf-navbar-collapse" role="navigation">
+            <ul class="nav navbar-nav navbar-right">
+                <!--<li class="active"><a href="/docs/"><span class="icns icon-book"></span></a></li>-->
+                <li class=""><a href="/community/"><span class="icns icon-group"></span></a></li>
+                <li><a href="http://github.com/usergrid/usergrid" target="_blank"><span class="icns icon-github-sign"></span></a></li>
+                <!--<li><a href="https://trello.com/b/exQmJIOn/usergrid" target="_blank"><span class="icns icon-trello"></span></a></li>-->
+                <li><a href="https://issues.apache.org/jira/browse/USERGRID" target="_blank"><span class="icns icon-bug"></span></a></li>
+                <li><a href="http://stackoverflow.com/search?q=usergrid" target="_blank"><span class="icns icon-stackexchange"></span></a></li>
+                <li><a href="http://webchat.freenode.net/?channels=%23usergrid&uio=d4" target="_blank"><span class="icns icon-comments"></span></a></li>
+                <!--<li><a href="https://groups.google.com/forum/#!forum/usergrid" target="_blank"><span class="icns icon-envelope"></span></a></li>-->
+                <li><a href="https://twitter.com/usergrid" target="_blank"><span class="icns icon-twitter"></span></a></li>
+            </ul>
+        </nav>
+    </div>
+    </header>
+
+
+<div class="container bf-docs-container">    
+    <div class="row">
+        <div class="col-md-3">
+            <div class="bf-sidebar hidden-print" role="complementary">
+                <ul class="nav nav-list">
+                    <li><a href="#">Getting Up & Running Locally</a></li>
+                    <li><a href="#"><code>ugc</code> — the Command-line Client</a></li>
+
+                    <li class="nav-header"><span>Concepts</span></li>
+                    <li>
+                        <a href="/docs/organizations-admins/">Organizations & Admins</a>
+                        <ul>
+                            <li>
+                                <a href="/docs/applications">Applications</a>
+                                <ul>
+                                    <li><a href="#">Roles & Permissions</a></li>
+                                    <li><a href="#">Queues</a></li>
+                                    <li><a href="#">Events & Counters</a></li>
+                                    <li>
+                                        <a href="#">Collections</a>
+                                        <ul>
+                                            <li><a href="#">Query Language</a></li>
+                                            <li><a href="#">Users & Devices</a></li>
+                                            <li><a href="#">Groups</a></li>
+                                            <li><a href="#">Activities</a></li>
+                                            <li><a href="#">Assets</a></li>
+                                        </ul>
+                                    </li>
+                                </ul>
+                            </li>
+                        </ul>
+                    </li>
+
+
+                    <li class="nav-header"><span>Usage</span></li>
+                    <li><a href="/docs/rest-api">REST API</a></li>
+                    <li><a class="icns-apple" href="#">iOS SDK</a></li>
+                    <li><a class="icns-android" href="#">Android SDK</a></li>
+                    <li><a class="icns-html5" href="/docs/html5-javascript-sdk">HTML5 / JavaScript SDK</a></li>
+                    <li><a class="icns-windows" href="#">Windows 8 / Windows Phone / .net SDK</a></li>
+                    <li><a href="/docs/nodejs-module">Node.js module</a></li>
+                    <li><a href="/docs/ruby-gem">Ruby gem</a></li>
+                    <li><a href="#">Ruby on Rails gem</a></li>
+                    <li><a href="#">PHP library</a></li>
+
+                    <li class="nav-header"><span>Internals</span></li>
+                    <li><a href="#">Design & Goals</a></li>
+                    <li><a href="#">Java Architecture</a></li>
+                    <li><a href="#">Cassandra Schema</a></li>
+                    <li><a href="#">Contributing</a></li>
+
+                    <li class="nav-header"><span>Operations</span></li>
+                    <li><a href="#">Deploying</a></li>
+                    <li><a href="#">Monitoring</a></li>
+                    <li><a href="#">Upgrading</a></li>
+                    <li><a href="#">Security</a></li>
+                </ul>
+            </div>
+        </div>
+
+        <div class="col-md-9 main-article" role="main">
+            <div class="page-article">
+                <div class="page-header">
+                    <h1>Uploading files and assets</h1>
+                  <small><a href="https://github.com/timanglade/usergrid-site/blob/master/content/docs/uploading-files-and-assets/">contribute to this article on github</a></small>
+                </div>
+                <div class="toc">
+	<ul>
+<li>
+<a href="#uploading-files-and-assets">Uploading files and assets</a><ul>
+<li><a href="#creating-a-folder-to-hold-assets">Creating a folder to hold assets</a></li>
+<li><a href="#creating-an-assets-entity">Creating an assets entity</a></li>
+<li><a href="#linking-a-folder-to-an-asset">Linking a folder to an asset</a></li>
+<li><a href="#retrieving-an-asset">Retrieving an asset</a></li>
+<li><a href="#uploading-and-retrieving-binary-data-for-an-asset">Uploading and retrieving binary data for an asset</a></li>
+<li><a href="#updating-the-binary-data-for-an-asset">Updating the binary data for an asset</a></li>
+</ul>
+</li>
+</ul>
+</div>
+<h1 id="uploading-files-and-assets"><a href="#uploading-files-and-assets">Uploading files and assets</a></h1>
+<p><strong>Beta Feature</strong><br> Please note that this is currently a beta feature. As a result, some functionality may not work as expected.</p>
+<p>Using Apache Usergrid APIs, you can store and retrieve files and assets that hold data objects such as images, video, and audio content.</p>
+<p>Apache Usergrid manages these objects as <a href="/assets">Assets</a> entities. Optionally, you can use <a href="/folder">Folder</a> entities to organize related assets.</p>
+<p><strong>Note:</strong> All binary objects are managed as assets. However, an asset does not have to be used for a binary object. For example, assets can be used to model a file system.</p>
+<h2 id="creating-a-folder-to-hold-assets"><a href="#creating-a-folder-to-hold-assets">Creating a folder to hold assets</a></h2>
+<p>Suppose you have some images that you want to store. Suppose too that you want to organize your images in folders. To create a folder, you issue a POST request to the folders endpoint. The general format of the request is:</p>
+<pre><code>POST /{org-uuid}/{app-uuid}/folders {request body}</code></pre>
+<p>The request body must specify the name of the folder, the UUID of the owner of the folder, as well as the relative path to the folder.</p>
+<p>Here’s how you could create a folder named myfirstfolder to hold some of the images:</p>
+<pre><code>POST https://api.usergrid.com/my-org/my-app/folders {"name": "myfirstfolder","owner": "7d1aa429-e978-11e0-8264-005056c00008", "path": "/myfolders/folder1"}</code></pre>
+<p><strong>Note:</strong> Although not shown in the API examples, you need to provide a valid access token with each API call. See <a href="/authenticating-users-and-application-clients">Authenticating users and application clients</a> for details. You also need to replace my-org with the name of your organization, my-app with the name of your application, and the UUID and path values as appropriate.</p>
+<p>The response to the API request should include the UUID of the created folder, for example:</p>
+<pre><code> "uuid": "6640a601-2ac6-11e2-92c3-02e81ae640dc"</code></pre>
+<p>You’ll need this UUID to link the folder to assets.</p>
+<h2 id="creating-an-assets-entity"><a href="#creating-an-assets-entity">Creating an assets entity</a></h2>
+<p>Assume that one of the images is named my-image.jpg. You can create an asset for the image by issuing a POST request to the assets endpoint. The general format of the request is:</p>
+<pre><code>POST /{org-uuid}/{app-uuid}/assets {request body}</code></pre>
+<p>The request body must specify the UUID of the name of the asset, the owner of the asset, as well as the relative path to the asset. For example, you can create an asset for the my-image.jpg image like this:</p>
+<pre><code>POST https://api.usergrid.com/my-org/my-app/assets {"name": "my-image.jpg","owner": "7d1aa429-e978-11e0-8264-005056c00008", "path": "/myassets/asset1"}</code></pre>
+<p>You can also specify a content-type property for the asset in the request body. For example, you can specify “content-type”:”image/jpeg”. That content type is then set as a property of the asset. It is also set (as specified) in the response header. Specifying the content-type is optional. Apache Usergrid can automatically detect the content type of the asset when the binary data for the asset is uploaded. It then sets this as the content-type property value on the asset.</p>
+<p>The response to the API request should include the UUID of the created asset, for example:</p>
+<pre><code>"uuid": "9501cda1-2d21-11e2-b4c6-02e81ac5a17b"</code></pre>
+<p>You’ll need this UUID when you upload or retrieve the image.</p>
+<h2 id="linking-a-folder-to-an-asset"><a href="#linking-a-folder-to-an-asset">Linking a folder to an asset</a></h2>
+<p>In order to access the asset for the image in the folder, you need to link the folder to the asset. You can do that by issuing a POST request in the following format:</p>
+<pre><code>POST /{org-uuid}/{app-uuid}/folders/{folder-uuid}/assets/{assets_id}</code></pre>
+<p>where {folder-uuid} is the UUID of the folder, and {assets-uuid} is the UUID of the assets entity.</p>
+<p>Here’s how you could link the folder and the asset you created for the my-image.jpg image:</p>
+<pre><code>POST https://api.usergrid.com/my-org/my-app/folders/6640a601-2ac6-11e2-92c3-02e81ae640dc/assets/9501cda1-2d21-11e2-b4c6-02e81ac5a17b </code></pre>
+<p>In the response, you should see the assets entity for the image added to the folder:</p>
+<pre><code>{
+  "action": "post",
+  "application": "3400ba10-cd0c-11e1-bcf7-12313d1c4491",
+  "params": {},
+  "path": "/folders/6640a601-2ac6-11e2-92c3-02e81ae640dc/assets",
+  "uri": "https://api.usergrid.com/my-org/my-app/folders/6640a601-2ac6-11e2-92c3-02e81ae640dc/assets",
+  "entities": [
+    {
+      "uuid": "9501cda1-2d21-11e2-b4c6-02e81ac5a17b",
+      "type": "asset",
+      "name": "my-image.jpg",
+      "created": 1352763303163,
+      "modified": 1352763303163,
+      "metadata": {
+        "path": "/folders/6640a601-2ac6-11e2-92c3-02e81ae640dc/assets/9501cda1-2d21-11e2-b4c6-02e81ac5a17b"
+      },
+      "owner": "5c0c1789-d503-11e1-b36a-12313b01d5c1",
+      "path": "/myassets/asset1"
+    }
+  ],
+  "timestamp": 1352830448045,
+  "duration": 54,
+  "organization": "my-org”,
+  "applicationName": "my-app"
+}</code></pre>
+<p>You can also request a list of the linked contents of the folder like this:</p>
+<pre><code>GET https://api.usergrid.com/my-org/my-app/folders/6640a601-2ac6-11e2-92c3-02e81ae640dc/assets</code></pre>
+<p>The response should look something like this:</p>
+<pre><code>{
+  "action": "get",
+  "application": "3400ba10-cd0c-11e1-bcf7-12313d1c4491",
+  "params": {
+    "_": [
+      "1352830364891"
+    ]
+  },
+  "path": "/folders/6640a601-2ac6-11e2-92c3-02e81ae640dc/assets",
+  "uri": "https://api.usergrid.com/my-org/my-app/folders/6640a601-2ac6-11e2-92c3-02e81ae640dc/assets",
+  "entities": [
+    {
+      "uuid": "7bf47435-2ac8-11e2-b4c6-02e81ac5a17b",
+      "type": "asset",
+      "name": "my-image.jpg",
+      "created": 1352505133598,
+      "modified": 1352507245108,
+      "checksum": "8e0cd3866ee20746c99e9a9825f38ad8",
+      "content-length": 11853,
+      "content-type": "image/jpeg",
+      "etag": "\"8e0cd3866ee20746c99e9a9825f38ad8\"",
+      "metadata": {
+        "connecting": {
+          "assets": "/folders/6640a601-2ac6-11e2-92c3-02e81ae640dc/assets/7bf47435-2ac8-11e2-b4c6-02e81ac5a17b/connecting/assets"
+        },
+        "connection": "assets",
+        "path": "/folders/6640a601-2ac6-11e2-92c3-02e81ae640dc/assets/7bf47435-2ac8-11e2-b4c6-02e81ac5a17b"
+      },
+      "owner": "5c0c1789-d503-11e1-b36a-12313b01d5c1",
+      "path": "my-image"
+    }
+  ],
+  "timestamp": 1352830363797,
+  "duration": 57,
+  "organization": "my-org",
+  "applicationName": "my-app"
+}</code></pre>
+<h2 id="retrieving-an-asset"><a href="#retrieving-an-asset">Retrieving an asset</a></h2>
+<p>You can retrieve an asset by its UUID. The general form of the request is:</p>
+<pre><code>GET /{org-uuid}/{app-uuid}/assets/{asset-uuid}</code></pre>
+<p>For example, to retrieve the asset for the my-image.jpg image, you make a request like this:</p>
+<pre><code>GET https://api.usergrid.com/my-org/my-app/assets/9501cda1-2d21-11e2-b4c6-02e81ac5a17b</code></pre>
+<p>The response should look something like this:</p>
+<pre><code>{
+  "action": "get",
+  "application": "3400ba10-cd0c-11e1-bcf7-12313d1c4491",
+  "params": {
+    "_": [
+      "1352833055831"
+    ]
+  },
+  "path": "/assets",
+  "uri": "https://api.usergrid.com/my-org/my-app/assets",
+  "entities": [
+    {
+      "uuid": "9501cda1-2d21-11e2-b4c6-02e81ac5a17b",
+      "type": "asset",
+      "name": "edhead3.jpg",
+      "created": 1352763303163,
+      "modified": 1352763303163,
+      "metadata": {
+        "connecting": {
+          "assets": "/assets/9501cda1-2d21-11e2-b4c6-02e81ac5a17b/connecting/assets"
+        },
+        "path": "/assets/9501cda1-2d21-11e2-b4c6-02e81ac5a17b"
+      },
+      "owner": "5c0c1789-d503-11e1-b36a-12313b01d5c1",
+      "path": "/myassets/asset1"
+    }
+  ],
+  "timestamp": 1352833055408,
+  "duration": 17,
+  "organization": "my-org",
+  "applicationName": "my-app"
+}</code></pre>
+<h2 id="uploading-and-retrieving-binary-data-for-an-asset"><a href="#uploading-and-retrieving-binary-data-for-an-asset">Uploading and retrieving binary data for an asset</a></h2>
+<p>So far the focus has been on assets entities, which App services uses to manage binary objects such as images. But what about the data for those objects? You can use Apache Usergrid APIs to upload the data for a binary object and retrieve the data.</p>
+<p><strong>Note:</strong> The data for an asset is stored separately from the entity itself.</p>
+<p>To upload data for an asset, you issue a POST request to the endpoint for the asset’s data. The general form of the request is:</p>
+<pre><code>POST /{org-uuid}/{app-uuid}/assets/{asset-uuid}/data {binary-data}</code></pre>
+<p>where {binary-data} is the binary data for the asset.</p>
+<p>For example, you can upload the binary data for the my-image.jpg image asset like this:</p>
+<pre><code>POST https://api.usergrid.com/my-org/my-app/assets/9501cda1-2d21-11e2-b4c6-02e81ac5a17b/data {binary data}</code></pre>
+<p>where {binary-data} is the binary data for the image.</p>
+<p>In cURL format, the upload request would look something like this:</p>
+<pre><code>POST  --data-binary "@src/resources/my-image.jpg" -H
+"Content-Type: application/octet-stream"
+‘https://api.usergrid.com/my-org/my-app/assets/9501cda1-2d21-11e2-b4c6-02e81ac5a17b/data’</code></pre>
+<p>In the cURL example, the binary data is in a file whose relative path is src/resources/my-image.jpg.</p>
+<p><strong>Note:</strong> Currently, a 5 MB limitation exists for the size of the uploaded binary data. This limitation is temporary and the allowable size of a data upload should increase soon.</p>
+<p>To retrieve the data, issue a GET request to the same endpoint, for example:</p>
+<pre><code>GET https://api.usergrid.com/my-org/my-app/assets/9501cda1-2d21-11e2-b4c6-02e81ac5a17b/data</code></pre>
+<p>In response, you’ll get the binary data for the asset.</p>
+<h2 id="updating-the-binary-data-for-an-asset"><a href="#updating-the-binary-data-for-an-asset">Updating the binary data for an asset</a></h2>
+<p>Suppose, you want to update the my-image.jpg image. You can do it by replacing the binary data for the asset through a PUT request. Here’s an example:</p>
+<pre><code>PUT https://api.usergrid.com/my-org/my-app/assets/9501cda1-2d21-11e2-b4c6-02e81ac5a17b/data {binary-data}</code></pre>
+<p>where {binary-data} is the updated binary data for the image.</p>
+<p>In cURL format, the update request would look something like this:</p>
+<pre><code>PUT  --data-binary "@src/resources/my-image2.jpg" -H
+"Content-Type: application/octet-stream"
+‘https://api.usergrid.com/my-org/my-app/assets/9501cda1-2d21-11e2-b4c6-02e81ac5a17b/data’</code></pre>
+<p>In the cURL example, the updated binary data is in a file whose relative path is src/resources/my-image2.jpg.</p>
+            </div>
+        </div>
+    </div>
+    <div class="row">
+        <div class="col-md-3"></div>
+        <div class="col-md-9">
+            <div class="github-callout">
+                <strong>Questions?</strong> Please do <a href="https://groups.google.com/forum/#!forum/usergrid">ask on the mailing-list</a>!<br/>
+                <strong>Found an error?</strong> We’d greatly appreciate a pull request about <a href="https://github.com/timanglade/usergrid-site/blob/master/content/docs/uploading-files-and-assets/">this article on github</a>.</div>
+        </div>
+    </div>
+</div>
+
+
+<footer class="bf-footer" role="contentinfo">
+    <div class="container">
+        <div class="row">
+            <div class="col-md-2">
+                <ul class="nav nav-list">
+                    <li class="nav-header"><a href="/">Home</a></li>
+                    <li class="nav-header"><a href="/community/">Community</a></li>
+                        <!-- <li><a href="/community#events">Events</a></li> -->
+                        <li><a href="/community/#mailing-lists">Mailing Lists</a></li>
+                        <li><a href="/community/#deployments">Deployments</a></li>
+                        <li><a href="/community/#committers">Commiters</a></li>
+                    <!-- <li class="nav-header"><a href="#">Docs</a></li> -->
+                </ul>
+            </div>
+            <div class="col-md-2">
+                <ul class="nav nav-list">
+                    <li class="nav-header"><a href="https://github.com/usergrid/usergrid/" target="_blank">Code</a></li>
+                    <li><a href="https://github.com/usergrid/usergrid/blob/master/stack" target="_blank">Server Stack</a></li>
+                    <li><a href="https://github.com/usergrid/usergrid/blob/master/portal" target="_blank">Admin Portal</a></li>
+                    <li><a href="https://github.com/usergrid/usergrid/blob/master/ugc" target="_blank">ugc command line</a></li>
+                    <li><a href="https://github.com/usergrid/usergrid/blob/master/sdks/ios" target="_blank">iOS SDK</a></li>
+                    <li><a href="https://github.com/usergrid/usergrid/blob/master/sdks/android" target="_blank">Android SDK</a></li>
+                    <li><a href="https://github.com/usergrid/usergrid/blob/master/sdks/html5-javascript" target="_blank">HTML5/JS SDK</a></li>
+                    <li><a href="https://github.com/usergrid/usergrid/blob/master/sdks/nodejs" target="_blank">node.js module</a></li>
+                    <li><a href="https://github.com/usergrid/usergrid/blob/master/sdks/ruby-on-rails" target="_blank">Ruby on Rails gem</a></li>
+                    <li><a href="https://github.com/usergrid/usergrid/blob/master/sdks/ruby" target="_blank">Ruby gem</a></li>
+                    <li><a href="https://github.com/usergrid/usergrid/blob/master/sdks/php" target="_blank">PHP SDK</a></li>
+                    <li><a href="https://github.com/usergrid/usergrid/blob/master/sdks/java" target="_blank">Java SDK</a></li>
+                    <li><a href="https://github.com/usergrid/usergrid/blob/master/sdks/dotnet" target="_blank">.NET / Windows SDK</a></li>
+                </ul>
+            </div>
+            <div class="col-md-2">
+                <ul class="nav nav-list">
+                    <li class="nav-header">Resources</li>
+                        <li><a href="http://github.com/usergrid/usergrid" target="_blank">GitHub Code</a></li>
+                        <li><a href="https://issues.apache.org/jira/browse/USERGRID" target="_blank">JIRA Bug Tracker</a></li>
+                        <li><a href="http://stackoverflow.com/search?q=usergrid" target="_blank">StackOverflow</a></li>
+                        <li><a href="http://webchat.freenode.net/?channels=%23usergrid&uio=d4">IRC</a></li>
+                        <li><a href="https://twitter.com/usergrid" target="_blank">Twitter</a></li>
+                        <li><a href="http://incubator.apache.org/projects/usergrid.html" target="_blank">Podling Listing</a></li>
+                        <li><a href="https://github.com/usergrid/usergrid/blob/master/LICENSE" target="_blank">License</a></li>
+                        <li><a href="https://github.com/usergrid/usergrid/blob/master/stack#requirements" target="_blank">Getting Started</a></li>
+                        <li><a href="https://github.com/usergrid/usergrid/blob/master/stack#contributing" target="_blank">Contribution Guidelines</a></li>
+                </ul>
+            </div>
+            <div class="col-md-2"></div>
+            <div class="col-md-4">
+                <a class="twitter-timeline" href="https://twitter.com/search?q=%23usergrid" data-widget-id="401499136807038976"  data-related="usergrid" height="400px" style="overflow:hidden">Tweets about "usergrid"</a>
+                <script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+"://platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script>
+            </div> 
+        <!--
+            <div class="col-md-4">
+                <div class="input-group form-search">
+                    <input type="text" class="form-control search-query">
+                    <span class="input-group-btn">
+                        <button type="submit" class="btn btn-primary" data-type="last">Search</button>
+                    </span>
+                </div>
+            </div> -->
+        </div> 
+        <div class="row">
+            <div id="copyright">
+                <img src="/img/egg-logo.png" /><br/><br/>
+                <p>Apache Usergrid is an effort undergoing incubation at The Apache Software Foundation (ASF), sponsored by the name of Apache TLP sponsor. Incubation is required of all newly accepted projects until a further review indicates that the infrastructure, communications, and decision making process have stabilized in a manner consistent with other successful ASF projects. While incubation status is not necessarily a reflection of the completeness or stability of the code, it does indicate that the project has yet to be fully endorsed by the ASF.</p>
+                <p>Copyright © 2013 The Apache Software Foundation, Licensed under the Apache License, Version 2.0.<br>
+                Apache and the Apache feather logos are trademarks of The Apache Software Foundation.</p>
+                <p class="credits">Site designed & assembled with love by <a href="https://github.com/ryuneeee">@ryuneeee</a> + <a href="https://github.com/realbeast">@realbeast</a> + <a href="https://twitter.com/timanglade">@timanglade</a>.</p>
+            </div>
+        </div>
+    </div>
+</footer>
+
+<script type="text/javascript" src="/js/head.js"></script>
+<script type="text/javascript">
+    head.js("/js/jquery-1.10.1.min.js", "/js/bootstrap.min.js", "/js/usergrid-site.js");
+</script>
+<script type="text/javascript">
+    //IE outdate friendly warning if you don't want remove it
+    var $buoop = {vs:{i:8,f:3.6,o:10.6,s:3.2,n:9}}
+    $buoop.ol = window.onload;
+    window.onload=function(){
+        try {if ($buoop.ol) $buoop.ol();}catch (e) {}
+        var e = document.createElement("script");
+        e.setAttribute("type", "text/javascript");
+        e.setAttribute("src", "http://browser-update.org/update.js");
+        document.body.appendChild(e);
+    }
+</script>
+
+
+</body>
+</html>
\ No newline at end of file



Mime
View raw message