add API to create/clear/delete Channels

This commit is contained in:
Lee Lawlor
2014-03-26 11:10:26 -04:00
parent 156f4147ef
commit 1343f72f7a
19 changed files with 439 additions and 29 deletions

View File

@ -8,11 +8,14 @@
<li class="subitem"><a href="#urls">Base URLs</a></li>
<li class="subitem"><a href="#api_keys">API Keys</a></li>
<li class="subitem"><a href="#rate_limits">Rate Limits / Caching</a></li>
<li class="subitem"><a href="#update">Update a Channel</a></li>
<li class="subitem"><a href="#update">Update Channel Feed</a></li>
<li class="subitem"><a href="#get_feed">Get Channel Feed</a></li>
<li class="subitem"><a href="#get_field">Get Channel Field Feed</a></li>
<li class="subitem"><a href="#get_status">Get Status Updates</a></li>
<li class="subitem"><a href="#list_public">List Public Channels</a></li>
<li class="subitem"><a href="#create">Create a Channel</a></li>
<li class="subitem"><a href="#clear">Clear a Channel</a></li>
<li class="subitem"><a href="#delete">Delete a Channel</a></li>
<li class="subitem"><a href="#importer">Importer</a></li>
<% else %>
<li><a href="/docs/channels">Channels</a></li>

View File

@ -116,6 +116,15 @@
<hr />
<%= render 'docs/channels/public_index' %>
<hr />
<%= render 'docs/channels/create' %>
<hr />
<%= render 'docs/channels/clear' %>
<hr />
<%= render 'docs/channels/destroy' %>
<br><br>
<hr />
<%= render 'docs/channels/importer' %>

View File

@ -0,0 +1,47 @@
<div>
<%= render 'response' %>
<h2 id="clear">Clear a Channel</h2>
</div>
<br>
To clear all feed data from a Channel, send an HTTP DELETE to <code><%= @ssl_api_domain %>channels/<span class="customcode">CHANNEL_ID</span>/feeds<span class="format format-json">.json</span><span class="format format-xml">.xml</span></code> .
<br><br>
Valid parameters:
<ul>
<li><b>api_key</b> (string) - User's API Key; please note that this is different than a Channel API key, and can be found in <a href="/account">your account details</a>. (required).</li>
</ul>
<br>
Example DELETE:
<pre>
DELETE <span class="str"><%= @ssl_api_domain %>channels/<span class="customcode">4</span>/feeds<span class="format format-json">.json</span><span class="format format-xml">.xml</span></span>
api_key=<span class="customcode"><%= @user_api_key %></span>
</pre>
<br>
<div class="format format-block format-text">
The response will be a webpage with your Channel.
</div>
<div class="format format-block format-json">
The response will be an empty JSON array, for example:
<pre class="prettyprint">
[]
</pre>
</div>
<div class="format format-block format-xml">
The response will be an empty XML array, for example:
<pre class="prettyprint">
&lt;?xml version="1.0" encoding="UTF-8"?>
&lt;nil-classes type="array" />
</pre>
</div>

View File

@ -0,0 +1,87 @@
<div>
<%= render 'response' %>
<h2 id="create">Create a Channel</h2>
</div>
<br>
To create a new Channel, send an HTTP POST to <code><%= @ssl_api_domain %>channels<span class="format format-json">.json</span><span class="format format-xml">.xml</span></code> .
<br><br>
Valid parameters:
<ul>
<li><b>api_key</b> (string) - User's API Key; please note that this is different than a Channel API key, and can be found in <a href="/account">your account details</a>. (required).</li>
<li><b>description</b> (string) - Description of the Channel (optional)</li>
<li><b>elevation</b> (integer) - Elevation in meters (optional)</li>
<li><b>field1</b> (string) - Field1 name (optional)</li>
<li><b>field2</b> (string) - Field2 name (optional)</li>
<li><b>field3</b> (string) - Field3 name (optional)</li>
<li><b>field4</b> (string) - Field4 name (optional)</li>
<li><b>field5</b> (string) - Field5 name (optional)</li>
<li><b>field6</b> (string) - Field6 name (optional)</li>
<li><b>field7</b> (string) - Field7 name (optional)</li>
<li><b>field8</b> (string) - Field8 name (optional)</li>
<li><b>latitude</b> (decimal) - Latitude in degrees (optional)</li>
<li><b>longitude</b> (decimal) - Longitude in degrees (optional)</li>
<li><b>name</b> (string) - Name of the Channel (optional)</li>
<li><b>public_flag</b> (true/false) - Whether the Channel should be public, default false (optional)</li>
<li><b>url</b> (string) - Webpage URL for the Channel (optional)</li>
</ul>
<br>
Example POST:
<pre>
POST <span class="str"><%= @ssl_api_domain %>channels<span class="format format-json">.json</span><span class="format format-xml">.xml</span></span>
api_key=<span class="customcode"><%= @user_api_key %></span>
name=<span class="customcode">My New Channel</span>
</pre>
<br>
<div class="format format-block-xl format-text">
The response will be a webpage with your newly created Channel.
</div>
<div class="format format-block-xl format-json">
The response will be a JSON object of the new channel, for example:
<pre class="prettyprint">
{
"id": 4,
"name": "My New Channel",
"description": null,
"latitude": null,
"longitude": null,
"created_at": "2014-03-25T13:12:50-04:00",
"elevation": null,
"last_entry_id": null,
"ranking": 15,
"username": "hans",
"tags": []
}
</pre>
</div>
<div class="format format-block-xl format-xml">
The response will be an XML object of the new channel, for example:
<pre class="prettyprint">
&lt;?xml version="1.0" encoding="UTF-8"?>
&lt;channel>
&lt;id type="integer">4&lt;/id>
&lt;name>My New Channel&lt;/name>
&lt;description nil="true" />
&lt;latitude type="decimal" nil="true" />
&lt;longitude type="decimal" nil="true" />
&lt;created-at type="dateTime">2014-03-25T20:17:44-04:00&lt;/created-at>
&lt;elevation nil="true" />
&lt;last-entry-id type="integer" nil="true" />
&lt;ranking type="integer">15&lt;/ranking>
&lt;username>hans&lt;/username>
&lt;tags type="array" />
&lt;/channel>
</pre>
</div>

View File

@ -0,0 +1,72 @@
<div>
<%= render 'response' %>
<h2 id="delete">Delete a Channel</h2>
</div>
<br>
To create a new Channel, send an HTTP DELETE to <code><%= @ssl_api_domain %>channels/<span class="customcode">CHANNEL_ID</span><span class="format format-json">.json</span><span class="format format-xml">.xml</span></code> ,
replacing <span class="customcode">CHANNEL_ID</span> with the ID of your Channel.
<br><br>
Valid parameters:
<ul>
<li><b>api_key</b> (string) - User's API Key; please note that this is different than a Channel API key, and can be found in <a href="/account">your account details</a>. (required).</li>
</ul>
<br>
Example DELETE:
<pre>
DELETE <span class="str"><%= @ssl_api_domain %>channels/<span class="customcode">4</span><span class="format format-json">.json</span><span class="format format-xml">.xml</span></span>
api_key=<span class="customcode"><%= @user_api_key %></span>
</pre>
<br>
<div class="format format-block-xl format-text">
The response will be a webpage with a list of Channels.
</div>
<div class="format format-block-xl format-json">
The response will be a JSON object of the Channel before it was deleted, for example:
<pre class="prettyprint">
{
"id": 4,
"name": "My New Channel",
"description": null,
"latitude": null,
"longitude": null,
"created_at": "2014-03-25T13:12:50-04:00",
"elevation": null,
"last_entry_id": null,
"ranking": 15,
"username": "hans",
"tags": []
}
</pre>
</div>
<div class="format format-block-xl format-xml">
The response will be an XML object of the Channel before it was deleted, for example:
<pre class="prettyprint">
&lt;?xml version="1.0" encoding="UTF-8"?>
&lt;channel>
&lt;id type="integer">4&lt;/id>
&lt;name>My New Channel&lt;/name>
&lt;description nil="true" />
&lt;latitude type="decimal" nil="true" />
&lt;longitude type="decimal" nil="true" />
&lt;created-at type="dateTime">2014-03-25T20:17:44-04:00&lt;/created-at>
&lt;elevation nil="true" />
&lt;last-entry-id type="integer" nil="true" />
&lt;ranking type="integer">15&lt;/ranking>
&lt;username>hans&lt;/username>
&lt;tags type="array" />
&lt;/channel>
</pre>
</div>

View File

@ -23,11 +23,11 @@ Example GET:
<br>
<div class="format format-block-xxl format-text">
<div class="format format-block-xxxl format-text">
The response will be a webpage with a <a href="/channels/public">list of public Channels</a>.
</div>
<div class="format format-block-xxl format-json">
<div class="format format-block-xxxl format-json">
The response will be a JSON object of public Channels, for example:
<pre class="prettyprint">
@ -87,7 +87,7 @@ Example GET:
</div>
<div class="format format-block-xxl format-xml">
<div class="format format-block-xxxl format-xml">
The response will be an XML object of public Channels, for example:
<pre class="prettyprint">

View File

@ -1,10 +1,10 @@
<div>
<%= render 'response' %>
<h2 id="update">Update a Channel</h2>
<h2 id="update">Update Channel Feed</h2>
</div>
<br>
To update a Channel, send an HTTP GET or POST to <code><%= @ssl_api_domain %>update<span class="format format-json">.json</span><span class="format format-xml">.xml</span></code> .
To update a Channel feed, send an HTTP GET or POST to <code><%= @ssl_api_domain %>update<span class="format format-json">.json</span><span class="format format-xml">.xml</span></code> .
<br><br>
Valid parameters: