blob: 3a7182b7593e4765720926fa1e68c6d3a6d0eb09 [file] [log] [blame]
<!DOCTYPE html>
<!--[if IE 8]><html class="no-js lt-ie9" lang="en" > <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js" lang="en" > <!--<![endif]-->
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Application &mdash; Apache Usergrid 2.x documentation</title>
<link rel="stylesheet" href="../_static/css/theme.css" type="text/css" />
<link rel="top" title="Apache Usergrid 2.x documentation" href="../index.html"/>
<link rel="next" title="Admin user" href="admin-user.html"/>
<link rel="prev" title="Organization" href="organization.html"/>
<script src="../_static/js/modernizr.min.js"></script>
</head>
<body class="wy-body-for-nav" role="document">
<div class="wy-grid-for-nav">
<nav data-toggle="wy-nav-shift" class="wy-nav-side">
<div class="wy-side-nav-search">
<a href="../index.html" class="icon icon-home"> Apache Usergrid
</a>
<div class="version">
2.x
</div>
<div role="search">
<form id="rtd-search-form" class="wy-form" action="../search.html" method="get">
<input type="text" name="q" placeholder="Search docs" />
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
</div>
</div>
<div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation">
<p class="caption"><span class="caption-text">Getting Started</span></p>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../introduction/overview.html">Getting Started</a></li>
<li class="toctree-l1"><a class="reference internal" href="../introduction/usergrid-features.html">Usergrid Features</a></li>
<li class="toctree-l1"><a class="reference internal" href="../introduction/data-model.html">Usergrid Data model</a></li>
<li class="toctree-l1"><a class="reference internal" href="../introduction/async-vs-sync.html">Async vs. sync calls</a></li>
</ul>
<p class="caption"><span class="caption-text">Using Usergrid</span></p>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../using-usergrid/creating-account.html">Creating a Usergrid Account</a></li>
<li class="toctree-l1"><a class="reference internal" href="../using-usergrid/creating-a-new-application.html">Creating a new application</a></li>
<li class="toctree-l1"><a class="reference internal" href="../using-usergrid/using-a-sandbox-app.html">Using a Sandbox Application</a></li>
<li class="toctree-l1"><a class="reference internal" href="../using-usergrid/using-the-api.html">Using the API</a></li>
</ul>
<p class="caption"><span class="caption-text">Data Storage</span></p>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../data-storage/data-store-dbms.html">The Usergrid Data Store</a></li>
<li class="toctree-l1"><a class="reference internal" href="../data-storage/optimizing-access.html">Data Store Best Practices</a></li>
<li class="toctree-l1"><a class="reference internal" href="../data-storage/collections.html">Collections</a></li>
<li class="toctree-l1"><a class="reference internal" href="../data-storage/entities.html">Entities</a></li>
</ul>
<p class="caption"><span class="caption-text">Data Queries</span></p>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../data-queries/querying-your-data.html">Querying your data</a></li>
<li class="toctree-l1"><a class="reference internal" href="../data-queries/query-parameters.html">Query parameters &amp; clauses</a></li>
<li class="toctree-l1"><a class="reference internal" href="../data-queries/operators-and-types.html">Query operators &amp; data types</a></li>
<li class="toctree-l1"><a class="reference internal" href="../data-queries/advanced-query-usage.html">Advanced query usage</a></li>
</ul>
<p class="caption"><span class="caption-text">Entity Connections</span></p>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../entity-connections/connecting-entities.html">Connecting entities</a></li>
<li class="toctree-l1"><a class="reference internal" href="../entity-connections/retrieving-entities.html">Retrieving connections</a></li>
<li class="toctree-l1"><a class="reference internal" href="../entity-connections/disconnecting-entities.html">Disconnecting entities</a></li>
</ul>
<p class="caption"><span class="caption-text">Push Notifications</span></p>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../push-notifications/overview.html">Push notifications overview</a></li>
<li class="toctree-l1"><a class="reference internal" href="../push-notifications/adding-push-support.html">Adding push notifications support</a></li>
<li class="toctree-l1"><a class="reference internal" href="../push-notifications/getting-started.html">Getting started with push notifications</a></li>
<li class="toctree-l1"><a class="reference internal" href="../push-notifications/tutorial.html">Tutorial: Push notifications sample app</a></li>
<li class="toctree-l1"><a class="reference internal" href="../push-notifications/registering.html">Registering with a notification service</a></li>
<li class="toctree-l1"><a class="reference internal" href="../push-notifications/creating-notifiers.html">Creating notifiers</a></li>
<li class="toctree-l1"><a class="reference internal" href="../push-notifications/managing-users-and-devices.html">Managing users and devices</a></li>
<li class="toctree-l1"><a class="reference internal" href="../push-notifications/creating-and-managing-notifications.html">Creating and managing notifications</a></li>
<li class="toctree-l1"><a class="reference internal" href="../push-notifications/troubleshooting.html">Troubleshooting</a></li>
</ul>
<p class="caption"><span class="caption-text">Security &amp; Authentication</span></p>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../security-and-auth/app-security.html">Security &amp; token authentication</a></li>
<li class="toctree-l1"><a class="reference internal" href="../security-and-auth/using-permissions.html">Using permissions</a></li>
<li class="toctree-l1"><a class="reference internal" href="../security-and-auth/using-roles.html">Using roles</a></li>
<li class="toctree-l1"><a class="reference internal" href="../security-and-auth/authenticating-users-and-application-clients.html">Authenticating users &amp; app clients</a></li>
<li class="toctree-l1"><a class="reference internal" href="../security-and-auth/user-authentication-types.html">Authentication levels</a></li>
<li class="toctree-l1"><a class="reference internal" href="../security-and-auth/changing-token-time-live-ttl.html">Changing token expiration (time-to-live)</a></li>
<li class="toctree-l1"><a class="reference internal" href="../security-and-auth/authenticating-api-requests.html">Authenticating API requests</a></li>
<li class="toctree-l1"><a class="reference internal" href="../security-and-auth/revoking-tokens-logout.html">Revoking tokens (logout)</a></li>
<li class="toctree-l1"><a class="reference internal" href="../security-and-auth/facebook-sign.html">Facebook sign in</a></li>
<li class="toctree-l1"><a class="reference internal" href="../security-and-auth/securing-your-app.html">Security best practices</a></li>
</ul>
<p class="caption"><span class="caption-text">User Management &amp; Social Graph</span></p>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../user-management/user-management.html">User management &amp; social graph</a></li>
<li class="toctree-l1"><a class="reference internal" href="../user-management/working-user-data.html">Working with User Data</a></li>
<li class="toctree-l1"><a class="reference internal" href="../user-management/group.html">Working with group data</a></li>
<li class="toctree-l1"><a class="reference internal" href="../user-management/activity.html">Activity</a></li>
<li class="toctree-l1"><a class="reference internal" href="../user-management/user-connections.html">Social Graph Connections</a></li>
<li class="toctree-l1"><a class="reference internal" href="../user-management/user-connections.html#creating-other-connections">Creating other connections</a></li>
<li class="toctree-l1"><a class="reference internal" href="../user-management/messagee-example.html">App Example - Messagee</a></li>
</ul>
<p class="caption"><span class="caption-text">Geo-location</span></p>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../geolocation/geolocation.html">Geolocating your Entities</a></li>
</ul>
<p class="caption"><span class="caption-text">Assets &amp; Files</span></p>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../assets-and-files/uploading-assets.html">Uploading assets</a></li>
<li class="toctree-l1"><a class="reference internal" href="../assets-and-files/retrieving-assets.html">Retrieving assets</a></li>
<li class="toctree-l1"><a class="reference internal" href="../assets-and-files/folders.html">Folders</a></li>
</ul>
<p class="caption"><span class="caption-text">Counters &amp; Events</span></p>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../counters-and-events/events-and-counters.html">Counters &amp; events</a></li>
<li class="toctree-l1"><a class="reference internal" href="../counters-and-events/creating-and-incrementing-counters.html">Creating &amp; incrementing counters</a></li>
<li class="toctree-l1"><a class="reference internal" href="../counters-and-events/creating-and-incrementing-counters.html#decrementing-resetting-counters">Decrementing/resetting counters</a></li>
<li class="toctree-l1"><a class="reference internal" href="../counters-and-events/creating-and-incrementing-counters.html#using-counters-hierarchically">Using counters hierarchically</a></li>
<li class="toctree-l1"><a class="reference internal" href="../counters-and-events/retrieving-counters.html">Retrieving counters</a></li>
</ul>
<p class="caption"><span class="caption-text">Organizations &amp; Applications</span></p>
<ul class="current">
<li class="toctree-l1"><a class="reference internal" href="managing.html">Organization &amp; application management</a></li>
<li class="toctree-l1"><a class="reference internal" href="organization.html">Organization</a></li>
<li class="toctree-l1 current"><a class="current reference internal" href="">Application</a><ul>
<li class="toctree-l2"><a class="reference internal" href="#creating-an-application">Creating an application</a><ul>
<li class="toctree-l3"><a class="reference internal" href="#request-uri">Request URI</a></li>
<li class="toctree-l3"><a class="reference internal" href="#example-request">Example - Request</a></li>
<li class="toctree-l3"><a class="reference internal" href="#example-response">Example - Response</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="#generating-application-credentials">Generating application credentials</a><ul>
<li class="toctree-l3"><a class="reference internal" href="#id1">Request URI</a></li>
<li class="toctree-l3"><a class="reference internal" href="#id2">Example - Request</a></li>
<li class="toctree-l3"><a class="reference internal" href="#id3">Example - Response</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="#getting-application-credentials">Getting application credentials</a><ul>
<li class="toctree-l3"><a class="reference internal" href="#id4">Request URI</a></li>
<li class="toctree-l3"><a class="reference internal" href="#id5">Example - Request</a></li>
<li class="toctree-l3"><a class="reference internal" href="#id6">Example - Response</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="#deleting-and-restoring-applications">Deleting and restoring Applications</a><ul>
<li class="toctree-l3"><a class="reference internal" href="#delete-application-request-uri">Delete Application: Request URI</a></li>
<li class="toctree-l3"><a class="reference internal" href="#delete-application-example-request">Delete Application: Example - Request</a></li>
<li class="toctree-l3"><a class="reference internal" href="#delete-application-example-response">Delete Application: Example - Response</a></li>
<li class="toctree-l3"><a class="reference internal" href="#restore-application-request-uri">Restore Application: Request URI</a></li>
<li class="toctree-l3"><a class="reference internal" href="#restore-application-example-request">Restore Application: Example - Request</a></li>
<li class="toctree-l3"><a class="reference internal" href="#restore-application-example-response">Restore Application: Example - Response</a></li>
<li class="toctree-l3"><a class="reference internal" href="#application-delete-and-restore-limitations">Application Delete and Restore Limitations</a></li>
</ul>
</li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="admin-user.html">Admin user</a></li>
</ul>
<p class="caption"><span class="caption-text">API Reference</span></p>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../rest-endpoints/api-docs.html">Methods</a></li>
<li class="toctree-l1"><a class="reference internal" href="../rest-endpoints/api-docs.html#models">Models</a></li>
<li class="toctree-l1"><a class="reference internal" href="../rest-endpoints/api-docs.html#sub-types">Sub-Types</a></li>
</ul>
<p class="caption"><span class="caption-text">Client SDKs</span></p>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../sdks/tbd.html">COMING SOON...</a></li>
</ul>
<p class="caption"><span class="caption-text">Installing Usergrid</span></p>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../installation/deployment-guide.html">Usergrid 2.1.0 Deployment Guide</a></li>
</ul>
<p class="caption"><span class="caption-text">More about Usergrid</span></p>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../reference/presos-and-videos.html">Presentations &amp; Videos</a></li>
<li class="toctree-l1"><a class="reference internal" href="../reference/contribute-code.html">How to Contribute Code &amp; Docs</a></li>
</ul>
</div>
&nbsp;
</nav>
<section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">
<nav class="wy-nav-top" role="navigation" aria-label="top navigation">
<i data-toggle="wy-nav-top" class="fa fa-bars"></i>
<a href="../index.html">Apache Usergrid</a>
</nav>
<div class="wy-nav-content">
<div class="rst-content">
<div role="navigation" aria-label="breadcrumbs navigation">
<ul class="wy-breadcrumbs">
<li><a href="../index.html">Docs</a> &raquo;</li>
<li>Application</li>
<li class="wy-breadcrumbs-aside">
<a href="../_sources/orgs-and-apps/application.txt" rel="nofollow"> View page source</a>
</li>
</ul>
<hr/>
</div>
<div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
<div itemprop="articleBody">
<div class="section" id="application">
<h1>Application<a class="headerlink" href="#application" title="Permalink to this headline"></a></h1>
<p>You can create a new application in an organization through the Admin
portal. The Admin portal creates the new application by issuing a post
against the management endpoint (see the <a class="reference external" href="../orgs-and-apps/application.html#creating-an-application">Creating an
Application</a>
section in Organization for details). If you need to create an
application programmatically in your app, you can also use the API to do
this. You can access application entities using your app name or UUID,
prefixed with the organization name or UUID:</p>
<div class="highlight-python"><div class="highlight"><pre>https://api.usergrid.com/{org_name|uuid}/{app_name|uuid}
</pre></div>
</div>
<p>Most mobile apps never access the application entity directly. For
example you might have a server-side web app that accesses the
application entity for configuration purposes. If you want to access
your application entity programmatically, you can use the API.</p>
<div class="section" id="creating-an-application">
<h2>Creating an application<a class="headerlink" href="#creating-an-application" title="Permalink to this headline"></a></h2>
<p>To create an application you POST a JSON object containing (at a
minimum) the name of the new application. You will also need to pass
authentication credentials.</p>
<div class="section" id="request-uri">
<h3>Request URI<a class="headerlink" href="#request-uri" title="Permalink to this headline"></a></h3>
<div class="highlight-python"><div class="highlight"><pre>POST /management/organizations|orgs/{org_name}|{org_uuid}/apps {request body}
</pre></div>
</div>
<p>Parameters</p>
<table border="1" class="docutils">
<colgroup>
<col width="13%" />
<col width="12%" />
<col width="75%" />
</colgroup>
<thead valign="bottom">
<tr class="row-odd"><th class="head">Parameter</th>
<th class="head">Sent in</th>
<th class="head">Description</th>
</tr>
</thead>
<tbody valign="top">
<tr class="row-even"><td>grant_type</td>
<td>Query string</td>
<td>Only the value &#8216;client_credentials&#8217; is supported.</td>
</tr>
<tr class="row-odd"><td>client_id</td>
<td>Query string</td>
<td>The org-level client id for your org, found in the &#8216;Org Administration&#8217; menu of Usergrid portal.</td>
</tr>
<tr class="row-even"><td>client_secret</td>
<td>Query string</td>
<td>The org-level client secret for your org, found in the &#8216;Org Administration&#8217; menu Usergrid portal.</td>
</tr>
<tr class="row-odd"><td>name</td>
<td>Request Body</td>
<td>The name of the application.</td>
</tr>
</tbody>
</table>
</div>
<div class="section" id="example-request">
<h3>Example - Request<a class="headerlink" href="#example-request" title="Permalink to this headline"></a></h3>
<div class="highlight-python"><div class="highlight"><pre>curl -X -i POST &quot;https://api.usergrid.com/management/orgs/testorg/apps?grant_type=client_credentials&amp;client_id=b3U68vghI6FmEeKn9wLoGtzz0A&amp;client_secret=b3U6ZuZ5_U8Y-bOaViJt0OyRkJFES-A&quot; -d &#39;{&quot;name&quot;:&quot;testapp1&quot;}&#39;
</pre></div>
</div>
</div>
<div class="section" id="example-response">
<h3>Example - Response<a class="headerlink" href="#example-response" title="Permalink to this headline"></a></h3>
<div class="highlight-python"><div class="highlight"><pre><span class="p">{</span>
<span class="s">&quot;action&quot;</span><span class="p">:</span> <span class="s">&quot;new application for organization&quot;</span><span class="p">,</span>
<span class="s">&quot;timestamp&quot;</span><span class="p">:</span> <span class="mi">1338914698135</span><span class="p">,</span>
<span class="s">&quot;duration&quot;</span><span class="p">:</span> <span class="mi">701</span>
<span class="p">}</span>
</pre></div>
</div>
</div>
</div>
<div class="section" id="generating-application-credentials">
<h2>Generating application credentials<a class="headerlink" href="#generating-application-credentials" title="Permalink to this headline"></a></h2>
<p>Use the POST method to generate the client ID and client secret
credentials for an application in an organization.</p>
<div class="section" id="id1">
<h3>Request URI<a class="headerlink" href="#id1" title="Permalink to this headline"></a></h3>
<div class="highlight-python"><div class="highlight"><pre><span class="n">POST</span> <span class="o">/</span><span class="n">organizations</span><span class="o">|</span><span class="n">orgs</span><span class="o">/</span><span class="p">{</span><span class="n">org_name</span><span class="p">}</span><span class="o">|</span><span class="p">{</span><span class="n">uuid</span><span class="p">}</span><span class="o">/</span><span class="n">applications</span><span class="o">|</span><span class="n">apps</span><span class="o">/</span><span class="p">{</span><span class="n">app_name</span><span class="p">}</span><span class="o">|</span><span class="p">{</span><span class="n">uuid</span><span class="p">}</span><span class="o">/</span><span class="n">credentials</span>
</pre></div>
</div>
<p>Parameters</p>
<table border="1" class="docutils">
<colgroup>
<col width="41%" />
<col width="59%" />
</colgroup>
<thead valign="bottom">
<tr class="row-odd"><th class="head">Parameter</th>
<th class="head">Description</th>
</tr>
</thead>
<tbody valign="top">
<tr class="row-even"><td>string org_name|arg uuid</td>
<td>Organization name or organization UUID.</td>
</tr>
<tr class="row-odd"><td>string app_name|arg uuid</td>
<td>Application name or application UUID.</td>
</tr>
</tbody>
</table>
<p>Note: You also need to provide a valid access token with the API call.
See <a class="reference external" href="../security_and_auth/authenticating-users-and-application-clients.html">Authenticating users and application
clients</a>
for details.</p>
</div>
<div class="section" id="id2">
<h3>Example - Request<a class="headerlink" href="#id2" title="Permalink to this headline"></a></h3>
<div class="highlight-python"><div class="highlight"><pre>curl -X POST &quot;https://api.usergrid.com/management/orgs/testorg/apps/testapp1/credentials&quot;
</pre></div>
</div>
</div>
<div class="section" id="id3">
<h3>Example - Response<a class="headerlink" href="#id3" title="Permalink to this headline"></a></h3>
<div class="highlight-python"><div class="highlight"><pre><span class="p">{</span>
<span class="s">&quot;action&quot;</span><span class="p">:</span> <span class="s">&quot;generate application client credentials&quot;</span><span class="p">,</span>
<span class="s">&quot;timestamp&quot;</span><span class="p">:</span> <span class="mi">1349815979529</span><span class="p">,</span>
<span class="s">&quot;duration&quot;</span><span class="p">:</span> <span class="mi">535</span><span class="p">,</span>
<span class="s">&quot;credentials&quot;</span><span class="p">:</span> <span class="p">{</span>
<span class="s">&quot;client_id&quot;</span><span class="p">:</span> <span class="s">&quot;YXA7ygil-f3TEeG-yhIxPQK1cQ&quot;</span><span class="p">,</span>
<span class="s">&quot;client_secret&quot;</span><span class="p">:</span> <span class="s">&quot;YXA65gYlqja8aYYSAy8Ox3Vg5aRZp48&quot;</span>
<span class="p">}</span>
<span class="p">}</span>
</pre></div>
</div>
</div>
</div>
<div class="section" id="getting-application-credentials">
<h2>Getting application credentials<a class="headerlink" href="#getting-application-credentials" title="Permalink to this headline"></a></h2>
<p>Use the GET method to retrieve the client ID and client secret
credentials for an application in an organization.</p>
<div class="section" id="id4">
<h3>Request URI<a class="headerlink" href="#id4" title="Permalink to this headline"></a></h3>
<div class="highlight-python"><div class="highlight"><pre><span class="n">GET</span> <span class="o">/</span><span class="n">organizations</span><span class="o">|</span><span class="n">orgs</span><span class="o">/</span><span class="p">{</span><span class="n">org_name</span><span class="p">}</span><span class="o">|</span><span class="p">{</span><span class="n">uuid</span><span class="p">}</span><span class="o">/</span><span class="n">applications</span><span class="o">|</span><span class="n">apps</span><span class="o">/</span><span class="p">{</span><span class="n">app_name</span><span class="p">}</span><span class="o">|</span><span class="p">{</span><span class="n">uuid</span><span class="p">}</span><span class="o">/</span><span class="n">credentials</span>
</pre></div>
</div>
<p>Parameters</p>
<table border="1" class="docutils">
<colgroup>
<col width="41%" />
<col width="59%" />
</colgroup>
<thead valign="bottom">
<tr class="row-odd"><th class="head">Parameter</th>
<th class="head">Description</th>
</tr>
</thead>
<tbody valign="top">
<tr class="row-even"><td>string org_name|arg uuid</td>
<td>Organization name or organization UUID.</td>
</tr>
<tr class="row-odd"><td>string app_name|arg uuid</td>
<td>Application name or application UUID.</td>
</tr>
</tbody>
</table>
<p>Note: You also need to provide a valid access token with the API call.
See <a class="reference external" href="../security_and_auth/authenticating-users-and-application-clients.html">Authenticating users and application
clients</a>
for details.</p>
</div>
<div class="section" id="id5">
<h3>Example - Request<a class="headerlink" href="#id5" title="Permalink to this headline"></a></h3>
<div class="highlight-python"><div class="highlight"><pre>curl -X GET &quot;https://api.usergrid.com/management/orgs/testorg/apps/testapp1/credentials&quot;
</pre></div>
</div>
</div>
<div class="section" id="id6">
<h3>Example - Response<a class="headerlink" href="#id6" title="Permalink to this headline"></a></h3>
<div class="highlight-python"><div class="highlight"><pre><span class="p">{</span>
<span class="s">&quot;action&quot;</span><span class="p">:</span> <span class="s">&quot;get application client credentials&quot;</span><span class="p">,</span>
<span class="s">&quot;timestamp&quot;</span><span class="p">:</span> <span class="mi">1349816819545</span><span class="p">,</span>
<span class="s">&quot;duration&quot;</span><span class="p">:</span> <span class="mi">7</span><span class="p">,</span>
<span class="s">&quot;credentials&quot;</span><span class="p">:</span> <span class="p">{</span>
<span class="s">&quot;client_id&quot;</span><span class="p">:</span> <span class="s">&quot;YXA7ygil-f3TEeG-yhIxPQK1cQ&quot;</span><span class="p">,</span>
<span class="s">&quot;client_secret&quot;</span><span class="p">:</span> <span class="s">&quot;YXA65gYlqja8aYYSAy8Ox3Vg5aRZp48&quot;</span>
<span class="p">}</span>
<span class="p">}</span>
</pre></div>
</div>
</div>
</div>
<div class="section" id="deleting-and-restoring-applications">
<h2>Deleting and restoring Applications<a class="headerlink" href="#deleting-and-restoring-applications" title="Permalink to this headline"></a></h2>
<p>Usergrid allows you to clean-up your Organizations by deleting old
Applications that you no longer need. With this feature, Applications
are not really deleted but they are hidden from view and may be restored
later. (At some point in the future, Usergrid may get the ability to
completely obliterate an Application, but that ability does not exist at
the time of this writing.)</p>
<div class="section" id="delete-application-request-uri">
<h3>Delete Application: Request URI<a class="headerlink" href="#delete-application-request-uri" title="Permalink to this headline"></a></h3>
<p>Only an authenticated Admin User can delete and restore Applications. To
delete an application, you send an authenticated HTTP <strong>DELETE</strong> request
to the /management end-point. The Request URI must specify the
Organization and the Application, both by identifier (name or UUID).
Here is the Request URI pattern:</p>
<div class="highlight-python"><div class="highlight"><pre>/management/organizations|orgs/{org_name}|{uuid}/applications|apps/{app_name}
</pre></div>
</div>
<p>Parameters</p>
<p>This is intentionally redundant, but you must confirm that you really
want to delete the Application by specifying its name or UUID, same as
that which you used in the Request URI.</p>
<table border="1" class="docutils">
<colgroup>
<col width="42%" />
<col width="58%" />
</colgroup>
<thead valign="bottom">
<tr class="row-odd"><th class="head">Parameter</th>
<th class="head">Description</th>
</tr>
</thead>
<tbody valign="top">
<tr class="row-even"><td>string confirm_application_id</td>
<td>Application identifier (either name or UUID)</td>
</tr>
</tbody>
</table>
<p>Note: You also need to provide a valid access token with the API call.
See <a class="reference external" href="../security_and_auth/authenticating-users-and-application-clients.html">Authenticating users and application
clients</a>
for details.</p>
</div>
<div class="section" id="delete-application-example-request">
<h3>Delete Application: Example - Request<a class="headerlink" href="#delete-application-example-request" title="Permalink to this headline"></a></h3>
<p>This example deletes an aApplication named &#8216;testapp1&#8217;</p>
<div class="highlight-python"><div class="highlight"><pre>curl -X DELETE &quot;https://api.usergrid.com/management/orgs/testorg/apps/testapp1?confirm_application_id=testapp1&quot;
</pre></div>
</div>
</div>
<div class="section" id="delete-application-example-response">
<h3>Delete Application: Example - Response<a class="headerlink" href="#delete-application-example-response" title="Permalink to this headline"></a></h3>
<p>The response echos back the action that was taken and the params, and an
HTTP 200 OK status message confirms that the Application has been
deleted.</p>
<div class="highlight-python"><div class="highlight"><pre>HTTP/1.1 200 OK
Access-Control-Allow-Origin: *
Content-Length: 276
Content-Type: application/json
Date: Mon, 06 Jun 2016 18:52:04 GMT
Server: Apache-Coyote/1.1
Set-Cookie: rememberMe=deleteMe; Path=/; Max-Age=0; Expires=Sun, 05-Jun-2016 18:52:04 GMT
{
&quot;action&quot;: &quot;delete&quot;,
&quot;application&quot;: &quot;d44dfc30-2c13-11e6-8b07-0a669fe1d66e&quot;,
&quot;applicationName&quot;: &quot;delete&quot;,
&quot;duration&quot;: 3,
&quot;organization&quot;: &quot;test-organization&quot;,
&quot;params&quot;: {
&quot;confirm_application_identifier&quot;: [
&quot;testapp1&quot;
]
},
&quot;timestamp&quot;: 1465239124645
}
</pre></div>
</div>
</div>
<div class="section" id="restore-application-request-uri">
<h3>Restore Application: Request URI<a class="headerlink" href="#restore-application-request-uri" title="Permalink to this headline"></a></h3>
<p>To Restore an Application that has been deleted you must know the
Application&#8217;s UUID. If you do a PUT to that application&#8217;s old URI, using
he UUID to identify it, then the Application will be restored.</p>
</div>
<div class="section" id="restore-application-example-request">
<h3>Restore Application: Example - Request<a class="headerlink" href="#restore-application-example-request" title="Permalink to this headline"></a></h3>
<p>For example, to restore &#8216;testapp1&#8217; that we deleted above:</p>
<div class="highlight-python"><div class="highlight"><pre>curl -X PUT &quot;https://api.usergrid.com/management/orgs/test-organization/apps/d44dfc30-2c13-11e6-8b07-0a669fe1d66e access_token==YWMtZR...&quot;
</pre></div>
</div>
</div>
<div class="section" id="restore-application-example-response">
<h3>Restore Application: Example - Response<a class="headerlink" href="#restore-application-example-response" title="Permalink to this headline"></a></h3>
<p>Here&#8217;s the response that indicates via HTTP 200 OK that the Application
has been restored.</p>
<div class="highlight-python"><div class="highlight"><pre>HTTP/1.1 200 OK
Access-Control-Allow-Origin: *
Content-Length: 223
Content-Type: application/json
Date: Mon, 06 Jun 2016 19:03:16 GMT
Server: Apache-Coyote/1.1
Set-Cookie: rememberMe=deleteMe; Path=/; Max-Age=0; Expires=Sun, 05-Jun-2016 19:03:16 GMT
{
&quot;action&quot;: &quot;restore&quot;,
&quot;application&quot;: &quot;d44dfc30-2c13-11e6-8b07-0a669fe1d66e&quot;,
&quot;applicationName&quot;: &quot;delete&quot;,
&quot;duration&quot;: 3,
&quot;organization&quot;: &quot;test-organization&quot;,
&quot;params&quot;: {},
&quot;timestamp&quot;: 1465239796913
}
</pre></div>
</div>
</div>
<div class="section" id="application-delete-and-restore-limitations">
<h3>Application Delete and Restore Limitations<a class="headerlink" href="#application-delete-and-restore-limitations" title="Permalink to this headline"></a></h3>
<p>At the time of this writing there are a couple of limitations regarding
Application Delete and Restore:</p>
<ul class="simple">
<li>Within an Organization, you cannot delete an Application with the
same name as an Application that you have deleted before.</li>
<li>Within an Organization, you cannot restore an Application is an
application with the very same name has been added since the orginal
one was deleted.</li>
</ul>
<p>Hopefully, these unnecessary limitations will be fixed soon; they are
tracked by this JIRA issue
<a class="reference external" href="https://issues.apache.org/jira/browse/USERGRID-1299">USERGRID-1299</a></p>
</div>
</div>
</div>
</div>
</div>
<footer>
<div class="rst-footer-buttons" role="navigation" aria-label="footer navigation">
<a href="admin-user.html" class="btn btn-neutral float-right" title="Admin user" accesskey="n">Next <span class="fa fa-arrow-circle-right"></span></a>
<a href="organization.html" class="btn btn-neutral" title="Organization" accesskey="p"><span class="fa fa-arrow-circle-left"></span> Previous</a>
</div>
<hr/>
<div role="contentinfo">
<p>
&copy; Copyright 2013-2015, Apache Usergrid.
</p>
</div>
Built with <a href="http://sphinx-doc.org/">Sphinx</a> using a <a href="https://github.com/snide/sphinx_rtd_theme">theme</a> provided by <a href="https://readthedocs.org">Read the Docs</a>.
</footer>
</div>
</div>
</section>
</div>
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT:'../',
VERSION:'2.x',
COLLAPSE_INDEX:false,
FILE_SUFFIX:'.html',
HAS_SOURCE: true
};
</script>
<script type="text/javascript" src="../_static/jquery.js"></script>
<script type="text/javascript" src="../_static/underscore.js"></script>
<script type="text/javascript" src="../_static/doctools.js"></script>
<script type="text/javascript" src="../_static/js/theme.js"></script>
<script type="text/javascript">
jQuery(function () {
SphinxRtdTheme.StickyNav.enable();
});
</script>
</body>
</html>