update documentation
This commit is contained in:
305
app/views/docs/channels/_feed.html.erb
Normal file
305
app/views/docs/channels/_feed.html.erb
Normal file
@ -0,0 +1,305 @@
|
||||
<div>
|
||||
<%= render 'response' %>
|
||||
<h2 id="get_feed">Get a Channel Feed</h2>
|
||||
</div>
|
||||
|
||||
<br>
|
||||
To view a Channel feed, send an HTTP GET 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> ,
|
||||
replacing <span class="customcode">CHANNEL_ID</span> with the ID of your Channel.
|
||||
|
||||
<br><br>
|
||||
Valid parameters:
|
||||
<ul>
|
||||
<li><b>key</b> (string) Read API Key for this specific Channel (optional--no key required for public channels)</li>
|
||||
<li><b>results</b> (integer) Number of entries to retrieve, 8000 max, default of 100 (optional)</li>
|
||||
<li><b>days</b> (integer) Days from now to include in feed (optional)</li>
|
||||
<li><b>start</b> (datetime) Start date in format YYYY-MM-DD%20HH:NN:SS (optional)</li>
|
||||
<li><b>end</b> (datetime) End date in format YYYY-MM-DD%20HH:NN:SS (optional)</li>
|
||||
<li><b>offset</b> (integer) Offset of your timezone without daylight savings time (optional)</li>
|
||||
<li><b>status</b> (true/false) Include status updates in feed by setting "status=true" (optional)</li>
|
||||
<li><b>location</b> (true/false) Include latitude, longitude, and elevation in feed by setting "location=true" (optional)</li>
|
||||
<li><b>min</b> (decimal) Minimum value to include in response (optional)</li>
|
||||
<li><b>max</b> (decimal) Maximum value to include in response (optional)</li>
|
||||
<li><b>round</b> (integer) Round to this many decimal places (optional)</li>
|
||||
<li><b>timescale</b> (integer or string) Get first value in this many minutes, valid values: 10, 15, 20, 30, 60, 240, 720, 1440, "daily" (optional)</li>
|
||||
<li><b>sum</b> (integer or string) Get sum of this many minutes, valid values: 10, 15, 20, 30, 60, 240, 720, 1440, "daily" (optional)</li>
|
||||
<li><b>average</b> (integer or string) Get average of this many minutes, valid values: 10, 15, 20, 30, 60, 240, 720, 1440, "daily" (optional)</li>
|
||||
<li><b>median</b> (integer or string) Get median of this many minutes, valid values: 10, 15, 20, 30, 60, 240, 720, 1440, "daily" (optional)</li>
|
||||
<li><b>callback</b> (string) Function name to be used for JSONP cross-domain requests (optional)</li>
|
||||
</ul>
|
||||
|
||||
<div class="alert alert-warning">
|
||||
Please note that the results parameter is not compatible with timescale, sum, average, or median.
|
||||
</div>
|
||||
|
||||
<br>
|
||||
Example GET:
|
||||
|
||||
<pre>GET <span class="str"><%= @ssl_api_domain %>channels/<span class="customcode">9</span>/feeds<span class="format format-json">.json</span><span class="format format-xml">.xml</span>?results=<span class="customcode">2</span></span></pre>
|
||||
|
||||
<br>
|
||||
|
||||
<div class="format format-block-xxl format-text">
|
||||
The response will be an HTML page with the JSON Channel feed, for example:
|
||||
|
||||
<pre class="prettyprint">
|
||||
{
|
||||
"channel":
|
||||
{
|
||||
"id": 9,
|
||||
"name": "my_house",
|
||||
"description": "Netduino Plus connected to sensors around the house",
|
||||
"latitude": "40.44",
|
||||
"longitude": "-79.996",
|
||||
"field1": "Light",
|
||||
"field2": "Outside Temperature",
|
||||
"created_at": "2010-12-13T20:20:06-05:00",
|
||||
"updated_at": "2014-02-26T12:43:04-05:00",
|
||||
"last_entry_id": 6060625
|
||||
},
|
||||
"feeds":
|
||||
[
|
||||
{
|
||||
"created_at": "2014-02-26T12:42:49-05:00",
|
||||
"entry_id": 6060624,
|
||||
"field1": "188",
|
||||
"field2": "25.902335456475583"
|
||||
},
|
||||
{
|
||||
"created_at": "2014-02-26T12:43:04-05:00",
|
||||
"entry_id": 6060625,
|
||||
"field1": "164",
|
||||
"field2": "25.222929936305732"
|
||||
}
|
||||
]
|
||||
}
|
||||
</pre>
|
||||
</div>
|
||||
|
||||
<div class="format format-block-xxl format-json">
|
||||
The response will be a JSON object of the Channel feed, for example:
|
||||
|
||||
<pre class="prettyprint">
|
||||
{
|
||||
"channel":
|
||||
{
|
||||
"id": 9,
|
||||
"name": "my_house",
|
||||
"description": "Netduino Plus connected to sensors around the house",
|
||||
"latitude": "40.44",
|
||||
"longitude": "-79.996",
|
||||
"field1": "Light",
|
||||
"field2": "Outside Temperature",
|
||||
"created_at": "2010-12-13T20:20:06-05:00",
|
||||
"updated_at": "2014-02-26T12:43:04-05:00",
|
||||
"last_entry_id": 6060625
|
||||
},
|
||||
"feeds":
|
||||
[
|
||||
{
|
||||
"created_at": "2014-02-26T12:42:49-05:00",
|
||||
"entry_id": 6060624,
|
||||
"field1": "188",
|
||||
"field2": "25.902335456475583"
|
||||
},
|
||||
{
|
||||
"created_at": "2014-02-26T12:43:04-05:00",
|
||||
"entry_id": 6060625,
|
||||
"field1": "164",
|
||||
"field2": "25.222929936305732"
|
||||
}
|
||||
]
|
||||
}
|
||||
</pre>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="format format-block-xxl format-xml">
|
||||
The response will be an XML object of the Channel feed, for example:
|
||||
|
||||
<pre class="prettyprint">
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<channel>
|
||||
<id type="integer">9</id>
|
||||
<name>my_house</name>
|
||||
<description>Netduino Plus connected to sensors around the house</description>
|
||||
<latitude type="decimal">40.44</latitude>
|
||||
<longitude type="decimal">-79.996</longitude>
|
||||
<field1>Light</field1>
|
||||
<field2>Outside Temperature</field2>
|
||||
<created-at type="dateTime">2010-12-13T20:20:06-05:00</created-at>
|
||||
<updated-at type="dateTime">2014-02-26T12:49:19-05:00</updated-at>
|
||||
<last-entry-id type="integer">6060650</last-entry-id>
|
||||
<feeds type="array">
|
||||
<feed>
|
||||
<created-at type="dateTime">2014-02-26T12:49:04-05:00</created-at>
|
||||
<entry-id type="integer">6060649</entry-id>
|
||||
<field1>160</field1>
|
||||
<field2>25.307855626326962</field2>
|
||||
<id type="integer" nil="true"/>
|
||||
</feed>
|
||||
<feed>
|
||||
<created-at type="dateTime">2014-02-26T12:49:19-05:00</created-at>
|
||||
<entry-id type="integer">6060650</entry-id>
|
||||
<field1>171</field1>
|
||||
<field2>22.929936305732483</field2>
|
||||
<id type="integer" nil="true"/>
|
||||
</feed>
|
||||
</feeds>
|
||||
</channel>
|
||||
</pre>
|
||||
|
||||
</div>
|
||||
|
||||
<br>
|
||||
|
||||
Live examples:
|
||||
<ul>
|
||||
<li><a href="http://api.thingspeak.com/channels/9/feeds.json">http://api.thingspeak.com/channels/9/feeds.json</a></li>
|
||||
<li><a href="http://api.thingspeak.com/channels/9/feeds.json?median=10">http://api.thingspeak.com/channels/9/feeds.json?median=10</a></li>
|
||||
<li><a href="http://api.thingspeak.com/channels/9/feeds.json?start=2011-11-11%2010:10:10&end=2011-11-11%2011:11:11">http://api.thingspeak.com/channels/9/feeds.json?start=2011-11-11%2010:10:10&end=2011-11-11%2011:11:11</a></li>
|
||||
</ul>
|
||||
|
||||
|
||||
<br><br>
|
||||
|
||||
<div>
|
||||
<%= render 'response' %>
|
||||
<h2>Get Last Entry in a Channel Feed</h2>
|
||||
</div>
|
||||
|
||||
<br>
|
||||
To get the last entry in a Channel feed, send an HTTP GET to <code><%= @ssl_api_domain %>channels/<span class="customcode">CHANNEL_ID</span>/feeds/last<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>key</b> (string) Read API Key for this specific Channel (optional--no key required for public channels)</li>
|
||||
<li><b>offset</b> (integer) Offset of your timezone without daylight savings time (optional)</li>
|
||||
<li><b>status</b> (true/false) Include status updates in feed by setting "status=true" (optional)</li>
|
||||
<li><b>location</b> (true/false) Include latitude, longitude, and elevation in feed by setting "location=true" (optional)</li>
|
||||
<li><b>callback</b> (string) Function name to be used for JSONP cross-domain requests (optional)</li>
|
||||
</ul>
|
||||
|
||||
<br>
|
||||
Example GET:
|
||||
|
||||
<pre>GET <span class="str"><%= @ssl_api_domain %>channels/<span class="customcode">9</span>/feeds/last<span class="format format-json">.json</span><span class="format format-xml">.xml</span></span></pre>
|
||||
|
||||
<br>
|
||||
|
||||
<div class="format format-block format-text">
|
||||
The response will be a JSON object of the most recent feed, for example:
|
||||
|
||||
<pre class="prettyprint">
|
||||
{
|
||||
"created_at": "2014-02-26T21:27:21Z",
|
||||
"entry_id": 6061519,
|
||||
"field1": "176",
|
||||
"field2": "28.195329087048833"
|
||||
}
|
||||
</pre>
|
||||
</div>
|
||||
|
||||
<div class="format format-block format-json">
|
||||
The response will be a JSON object of the most recent feed, for example:
|
||||
|
||||
<pre class="prettyprint">
|
||||
{
|
||||
"created_at": "2014-02-26T21:27:21Z",
|
||||
"entry_id": 6061519,
|
||||
"field1": "176",
|
||||
"field2": "28.195329087048833"
|
||||
}
|
||||
</pre>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="format format-block format-xml">
|
||||
The response will be an XML object of the most recent feed, for example:
|
||||
|
||||
<pre class="prettyprint">
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<feed>
|
||||
<created-at type="dateTime">2014-02-26T21:28:51Z</created-at>
|
||||
<entry-id type="integer">6061525</entry-id>
|
||||
<field1>200</field1>
|
||||
<field2>28.365180467091296</field2>
|
||||
<id type="integer" nil="true"/>
|
||||
</feed>
|
||||
</pre>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<br><br>
|
||||
|
||||
<div>
|
||||
<%= render 'response' %>
|
||||
<h2>Get Specific Entry in a Channel</h2>
|
||||
</div>
|
||||
|
||||
<br>
|
||||
To get a specific entry in a Channel's feed, send an HTTP GET to <code><%= @ssl_api_domain %>channels/<span class="customcode">CHANNEL_ID</span>/feeds/<span class="customcode">ENTRY_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 and <span class="customcode">ENTRY_ID</span> with the ID of your entry.
|
||||
|
||||
<br><br>
|
||||
Valid parameters:
|
||||
<ul>
|
||||
<li><b>key</b> (string) Read API Key for this specific Channel (optional--no key required for public channels)</li>
|
||||
<li><b>offset</b> (integer) Offset of your timezone without daylight savings time (optional)</li>
|
||||
<li><b>status</b> (true/false) Include status updates in feed by setting "status=true" (optional)</li>
|
||||
<li><b>location</b> (true/false) Include latitude, longitude, and elevation in feed by setting "location=true" (optional)</li>
|
||||
<li><b>callback</b> (string) Function name to be used for JSONP cross-domain requests (optional)</li>
|
||||
</ul>
|
||||
|
||||
<br>
|
||||
Example GET:
|
||||
|
||||
<pre>GET <span class="str"><%= @ssl_api_domain %>channels/<span class="customcode">9</span>/feeds/<span class="customcode">6061519</span><span class="format format-json">.json</span><span class="format format-xml">.xml</span></span></pre>
|
||||
|
||||
<br>
|
||||
|
||||
<div class="format format-block format-text">
|
||||
The response will be a JSON object of the feed entry, for example:
|
||||
|
||||
<pre class="prettyprint">
|
||||
{
|
||||
"created_at": "2014-02-26T21:27:21Z",
|
||||
"entry_id": 6061519,
|
||||
"field1": "176",
|
||||
"field2": "28.195329087048833"
|
||||
}
|
||||
</div>
|
||||
|
||||
<div class="format format-block format-json">
|
||||
The response will be a JSON object of the feed entry, for example:
|
||||
|
||||
<pre class="prettyprint">
|
||||
{
|
||||
"created_at": "2014-02-26T21:27:21Z",
|
||||
"entry_id": 6061519,
|
||||
"field1": "176",
|
||||
"field2": "28.195329087048833"
|
||||
}
|
||||
</pre>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="format format-block format-xml">
|
||||
The response will be an XML object of the most recent feed, for example:
|
||||
|
||||
<pre class="prettyprint">
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<feed>
|
||||
<created-at type="dateTime">2014-02-26T21:27:21Z</created-at>
|
||||
<entry-id type="integer">6061519</entry-id>
|
||||
<field1>176</field1>
|
||||
<field2>28.195329087048833</field2>
|
||||
<id type="integer" nil="true"/>
|
||||
</feed>
|
||||
</pre>
|
||||
|
||||
</div>
|
||||
|
213
app/views/docs/channels/_field.html.erb
Normal file
213
app/views/docs/channels/_field.html.erb
Normal file
@ -0,0 +1,213 @@
|
||||
<div>
|
||||
<%= render 'response' %>
|
||||
<h2 id="get_field">Get a Channel Field Feed</h2>
|
||||
</div>
|
||||
|
||||
<br>
|
||||
To view a Channel's field feed, send an HTTP GET to <code><%= @ssl_api_domain %>channels/<span class="customcode">CHANNEL_ID</span>/fields/<span class="customcode">FIELD_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 and <span class="customcode">FIELD_ID</span> with the ID of your field.
|
||||
|
||||
<br><br>
|
||||
Valid parameters:
|
||||
<ul>
|
||||
<li><b>key</b> (string) Read API Key for this specific Channel (optional--no key required for public channels)</li>
|
||||
<li><b>results</b> (integer) Number of entries to retrieve, 8000 max, default of 100 (optional)</li>
|
||||
<li><b>days</b> (integer) Days from now to include in feed (optional)</li>
|
||||
<li><b>start</b> (datetime) Start date in format YYYY-MM-DD%20HH:NN:SS (optional)</li>
|
||||
<li><b>end</b> (datetime) End date in format YYYY-MM-DD%20HH:NN:SS (optional)</li>
|
||||
<li><b>offset</b> (integer) Offset of your timezone without daylight savings time (optional)</li>
|
||||
<li><b>status</b> (true/false) Include status updates in feed by setting "status=true" (optional)</li>
|
||||
<li><b>location</b> (true/false) Include latitude, longitude, and elevation in feed by setting "location=true" (optional)</li>
|
||||
<li><b>min</b> (decimal) Minimum value to include in response (optional)</li>
|
||||
<li><b>max</b> (decimal) Maximum value to include in response (optional)</li>
|
||||
<li><b>round</b> (integer) Round to this many decimal places (optional)</li>
|
||||
<li><b>timescale</b> (integer or string) Get first value in this many minutes, valid values: 10, 15, 20, 30, 60, 240, 720, 1440, "daily" (optional)</li>
|
||||
<li><b>sum</b> (integer or string) Get sum of this many minutes, valid values: 10, 15, 20, 30, 60, 240, 720, 1440, "daily" (optional)</li>
|
||||
<li><b>average</b> (integer or string) Get average of this many minutes, valid values: 10, 15, 20, 30, 60, 240, 720, 1440, "daily" (optional)</li>
|
||||
<li><b>median</b> (integer or string) Get median of this many minutes, valid values: 10, 15, 20, 30, 60, 240, 720, 1440, "daily" (optional)</li>
|
||||
<li><b>callback</b> (string) Function name to be used for JSONP cross-domain requests (optional)</li>
|
||||
</ul>
|
||||
|
||||
<div class="alert alert-warning">
|
||||
Please note that the results parameter is not compatible with timescale, sum, average, or median.
|
||||
</div>
|
||||
|
||||
<br>
|
||||
Example GET:
|
||||
|
||||
<pre>GET <span class="str"><%= @ssl_api_domain %>channels/<span class="customcode">9</span>/fields/<span class="customcode">1</span><span class="format format-json">.json</span><span class="format format-xml">.xml</span>?results=<span class="customcode">2</span></span></pre>
|
||||
|
||||
<br>
|
||||
|
||||
<div class="format format-block-xxl format-text">
|
||||
The response will be an HTML page with the JSON Channel's field feed, for example:
|
||||
|
||||
<pre class="prettyprint">
|
||||
{
|
||||
"channel":
|
||||
{
|
||||
"id": 9,
|
||||
"name": "my_house",
|
||||
"description": "Netduino Plus connected to sensors around the house",
|
||||
"latitude": "40.44",
|
||||
"longitude": "-79.996",
|
||||
"field1": "Light",
|
||||
"field2": "Outside Temperature",
|
||||
"created_at": "2010-12-13T20:20:06-05:00",
|
||||
"updated_at": "2014-02-26T12:43:04-05:00",
|
||||
"last_entry_id": 6060625
|
||||
},
|
||||
"feeds":
|
||||
[
|
||||
{
|
||||
"created_at": "2014-02-26T12:42:49-05:00",
|
||||
"entry_id": 6060624,
|
||||
"field1": "188"
|
||||
},
|
||||
{
|
||||
"created_at": "2014-02-26T12:43:04-05:00",
|
||||
"entry_id": 6060625,
|
||||
"field1": "164"
|
||||
}
|
||||
]
|
||||
}
|
||||
</pre>
|
||||
</div>
|
||||
|
||||
<div class="format format-block-xxl format-json">
|
||||
The response will be a JSON object of the Channel's field feed, for example:
|
||||
|
||||
<pre class="prettyprint">
|
||||
{
|
||||
"channel":
|
||||
{
|
||||
"id": 9,
|
||||
"name": "my_house",
|
||||
"description": "Netduino Plus connected to sensors around the house",
|
||||
"latitude": "40.44",
|
||||
"longitude": "-79.996",
|
||||
"field1": "Light",
|
||||
"field2": "Outside Temperature",
|
||||
"created_at": "2010-12-13T20:20:06-05:00",
|
||||
"updated_at": "2014-02-26T12:43:04-05:00",
|
||||
"last_entry_id": 6060625
|
||||
},
|
||||
"feeds":
|
||||
[
|
||||
{
|
||||
"created_at": "2014-02-26T12:42:49-05:00",
|
||||
"entry_id": 6060624,
|
||||
"field1": "188"
|
||||
},
|
||||
{
|
||||
"created_at": "2014-02-26T12:43:04-05:00",
|
||||
"entry_id": 6060625,
|
||||
"field1": "164"
|
||||
}
|
||||
]
|
||||
}
|
||||
</pre>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="format format-block-xxl format-xml">
|
||||
The response will be an XML object of the Channel's field feed, for example:
|
||||
|
||||
<pre class="prettyprint">
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<channel>
|
||||
<id type="integer">9</id>
|
||||
<name>my_house</name>
|
||||
<description>Netduino Plus connected to sensors around the house</description>
|
||||
<latitude type="decimal">40.44</latitude>
|
||||
<longitude type="decimal">-79.996</longitude>
|
||||
<field1>Light</field1>
|
||||
<field2>Outside Temperature</field2>
|
||||
<created-at type="dateTime">2010-12-13T20:20:06-05:00</created-at>
|
||||
<updated-at type="dateTime">2014-02-26T12:49:19-05:00</updated-at>
|
||||
<last-entry-id type="integer">6060650</last-entry-id>
|
||||
<feeds type="array">
|
||||
<feed>
|
||||
<created-at type="dateTime">2014-02-26T12:49:04-05:00</created-at>
|
||||
<entry-id type="integer">6060649</entry-id>
|
||||
<field1>160</field1>
|
||||
<id type="integer" nil="true"/>
|
||||
</feed>
|
||||
<feed>
|
||||
<created-at type="dateTime">2014-02-26T12:49:19-05:00</created-at>
|
||||
<entry-id type="integer">6060650</entry-id>
|
||||
<field1>171</field1>
|
||||
<id type="integer" nil="true"/>
|
||||
</feed>
|
||||
</feeds>
|
||||
</channel>
|
||||
</pre>
|
||||
|
||||
</div>
|
||||
|
||||
<br><br>
|
||||
|
||||
<div>
|
||||
<%= render 'response' %>
|
||||
<h2>Get Last Entry in a Field Feed</h2>
|
||||
</div>
|
||||
|
||||
<br>
|
||||
To get the last entry in a Channel's field feed, send an HTTP GET to <code><%= @ssl_api_domain %>channels/<span class="customcode">CHANNEL_ID</span>/fields/<span class="customcode">FIELD_ID</span>/last<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 and <span class="customcode">FIELD_ID</span> with the ID of your field.
|
||||
|
||||
<br><br>
|
||||
Valid parameters:
|
||||
<ul class="format-block">
|
||||
<li><b>key</b> (string) Read API Key for this specific Channel (optional--no key required for public channels)</li>
|
||||
<li><b>offset</b> (integer) Offset of your timezone without daylight savings time (optional)</li>
|
||||
<li><b>status</b> (true/false) Include status updates in feed by setting "status=true" (optional)</li>
|
||||
<li><b>location</b> (true/false) Include latitude, longitude, and elevation in feed by setting "location=true" (optional)</li>
|
||||
<li><b>callback</b> (string) Function name to be used for JSONP cross-domain requests (optional)</li>
|
||||
<li class="format format-text"><b>prepend</b> (string) Text to add before the API response (optional)</li>
|
||||
<li class="format format-text"><b>append</b> (string) Text to add after the API response (optional)</li>
|
||||
</ul>
|
||||
|
||||
<br>
|
||||
Example GET:
|
||||
|
||||
<pre>GET <span class="str"><%= @ssl_api_domain %>channels/<span class="customcode">9</span>/fields/<span class="customcode">1</span>/last<span class="format format-json">.json</span><span class="format format-xml">.xml</span></span></pre>
|
||||
|
||||
<br>
|
||||
|
||||
<div class="format format-block format-text">
|
||||
The response will be the Channel field's most recent value, for example:
|
||||
|
||||
<pre class="prettyprint">
|
||||
176
|
||||
</pre>
|
||||
</div>
|
||||
|
||||
<div class="format format-block format-json">
|
||||
The response will be a JSON object of the most recent feed, for example:
|
||||
|
||||
<pre class="prettyprint">
|
||||
{
|
||||
"created_at": "2014-02-26T21:27:21Z",
|
||||
"entry_id": 6061519,
|
||||
"field1": "176"
|
||||
}
|
||||
</pre>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="format format-block format-xml">
|
||||
The response will be an XML object of the most recent feed, for example:
|
||||
|
||||
<pre class="prettyprint">
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<feed>
|
||||
<created-at type="dateTime">2014-02-26T21:28:51Z</created-at>
|
||||
<entry-id type="integer">6061525</entry-id>
|
||||
<field1>200</field1>
|
||||
<id type="integer" nil="true"/>
|
||||
</feed>
|
||||
</pre>
|
||||
|
||||
</div>
|
||||
|
8
app/views/docs/channels/_importer.html.erb
Normal file
8
app/views/docs/channels/_importer.html.erb
Normal file
@ -0,0 +1,8 @@
|
||||
<h2 id="importer">Importer</h2>
|
||||
|
||||
<p>Using the ThingSpeak Importer, you are able to import data from a CSV file directly into a ThingSpeak Channel. The access the Importer, select a <em>Channel</em>, and click <em>Import Data</em>.</p>
|
||||
<p>The format for the CSV should be the following:</p>
|
||||
<pre>datetime,field1,field2,field3,field4,field5,field6,field7,field8,latitude,longitude,elevation,status</pre>
|
||||
<p>Here is an example CSV file: <a title="ThingSpeak Import Sample Data" href="/files/importer_sample.csv" target="_blank">Sample CSV File</a></p>
|
||||
You only have to send a datetime stamp and at least one field. The datetime stamp can be in many formats such as epoch, ISO 8601, or MySQL time. If the datetime includes a GMT/UTC offset, we will use that to properly import the data. If your datetime stamps do not have a GMT / UTC offset, you can specify a time zone that the data was logged in.
|
||||
|
149
app/views/docs/channels/_public_index.html.erb
Normal file
149
app/views/docs/channels/_public_index.html.erb
Normal file
@ -0,0 +1,149 @@
|
||||
<div>
|
||||
<%= render 'response' %>
|
||||
<h2 id="list_public">List Public Channels</h2>
|
||||
</div>
|
||||
|
||||
<br>
|
||||
To view a list of public Channels, send an HTTP GET to
|
||||
<br>
|
||||
<code><%= @ssl_api_domain %>channels/public<span class="format format-json">.json</span><span class="format format-xml">.xml</span></code> .
|
||||
|
||||
<br><br>
|
||||
Valid parameters:
|
||||
<ul>
|
||||
<li><b>page</b> (integer) Page number to retrieve (optional)</li>
|
||||
<li><b>tag</b> (string) Name of tag to search for (optional)</li>
|
||||
<li><b>username</b> (string) Person's username that you want to search Channels for (optional)</li>
|
||||
</ul>
|
||||
|
||||
<br>
|
||||
Example GET:
|
||||
|
||||
<pre>GET <span class="str"><%= @ssl_api_domain %>channels/public<span class="format format-json">.json</span><span class="format format-xml">.xml</span></span></pre>
|
||||
|
||||
<br>
|
||||
|
||||
<div class="format format-block-xxl 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">
|
||||
The response will be a JSON object of public Channels, for example:
|
||||
|
||||
<pre class="prettyprint">
|
||||
{
|
||||
"pagination":
|
||||
{
|
||||
"current_page": 1,
|
||||
"per_page": 15,
|
||||
"total_entries": 653
|
||||
},
|
||||
"channels":
|
||||
[
|
||||
{
|
||||
"id": 9,
|
||||
"name": "my_house",
|
||||
"description": "Netduino Plus connected to sensors around the house",
|
||||
"latitude": "40.44",
|
||||
"longitude": "-79.996",
|
||||
"created_at": "2010-12-13T20:20:06-05:00",
|
||||
"elevation": "",
|
||||
"last_entry_id": 6062691,
|
||||
"ranking" :100,
|
||||
"username":"hans",
|
||||
"tags":
|
||||
[
|
||||
{
|
||||
"id": 9,
|
||||
"name": "temp"
|
||||
},{
|
||||
"id": 25,
|
||||
"name": "light"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": 5683,
|
||||
"name": "Residential Data Points",
|
||||
"description": "Arduino Uno + Ethernet Shield",
|
||||
"latitude": "35.664548",
|
||||
"longitude": "-78.654972",
|
||||
"created_at": "2013-05-15T12:33:57-04:00",
|
||||
"elevation": "100",
|
||||
"last_entry_id": 731713,
|
||||
"ranking": 100,
|
||||
"username": "samlro",
|
||||
"tags":
|
||||
[
|
||||
{
|
||||
"id": 950,
|
||||
"name": "Analog Inputs"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
</pre>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="format format-block-xxl format-xml">
|
||||
The response will be an XML object of public Channels, for example:
|
||||
|
||||
<pre class="prettyprint">
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<response>
|
||||
<pagination>
|
||||
<current-page type="WillPaginate::PageNumber">1</current-page>
|
||||
<per-page type="integer">15</per-page>
|
||||
<total-entries type="integer">654</total-entries>
|
||||
</pagination>
|
||||
<channels type="array">
|
||||
<channel>
|
||||
<id type="integer">9</id>
|
||||
<name>my_house</name>
|
||||
<description>
|
||||
Netduino Plus connected to sensors around the house
|
||||
</description>
|
||||
<latitude type="decimal">40.44</latitude>
|
||||
<longitude type="decimal">-79.996</longitude>
|
||||
<created-at type="dateTime">2010-12-13T20:20:06-05:00</created-at>
|
||||
<elevation/>
|
||||
<last-entry-id type="integer">6062720</last-entry-id>
|
||||
<ranking type="integer">100</ranking>
|
||||
<username>hans</username>
|
||||
<tags type="array">
|
||||
<tag>
|
||||
<id type="integer">9</id>
|
||||
<name>temp</name>
|
||||
</tag>
|
||||
<tag>
|
||||
<id type="integer">25</id>
|
||||
<name>light</name>
|
||||
</tag>
|
||||
</tags>
|
||||
</channel>
|
||||
<channel>
|
||||
<id type="integer">5683</id>
|
||||
<name>Residential Data Points</name>
|
||||
<description>Arduino Uno + Ethernet Shield</description>
|
||||
<latitude type="decimal">35.664548</latitude>
|
||||
<longitude type="decimal">-78.654972</longitude>
|
||||
<created-at type="dateTime">2013-05-15T12:33:57-04:00</created-at>
|
||||
<elevation>100</elevation>
|
||||
<last-entry-id type="integer">731720</last-entry-id>
|
||||
<ranking type="integer">100</ranking>
|
||||
<username>samlro</username>
|
||||
<tags type="array">
|
||||
<tag>
|
||||
<id type="integer">950</id>
|
||||
<name>Analog Inputs</name>
|
||||
</tag>
|
||||
</tags>
|
||||
</channel>
|
||||
</channels>
|
||||
</response>
|
||||
</pre>
|
||||
|
||||
</div>
|
||||
|
109
app/views/docs/channels/_status.html.erb
Normal file
109
app/views/docs/channels/_status.html.erb
Normal file
@ -0,0 +1,109 @@
|
||||
<div>
|
||||
<%= render 'response' %>
|
||||
<h2 id="get_status">Get Status Updates</h2>
|
||||
</div>
|
||||
|
||||
<br>
|
||||
To view a Channel's status updates, send an HTTP GET to <code><%= @ssl_api_domain %>channels/<span class="customcode">CHANNEL_ID</span>/status<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>key</b> (string) Read API Key for this specific Channel (optional--no key required for public channels)</li>
|
||||
<li><b>offset</b> (integer) Offset of your timezone without daylight savings time (optional)</li>
|
||||
<li><b>callback</b> (string) Function name to be used for JSONP cross-domain requests (optional)</li>
|
||||
</ul>
|
||||
|
||||
<br>
|
||||
Example GET:
|
||||
|
||||
<pre>GET <span class="str"><%= @ssl_api_domain %>channels/<span class="customcode">1417</span>/status<span class="format format-json">.json</span><span class="format format-xml">.xml</span></span></pre>
|
||||
|
||||
<br>
|
||||
|
||||
<div class="format format-block-xxl format-text">
|
||||
The response will be a JSON object of Channel statuses, for example:
|
||||
|
||||
<pre class="prettyprint">
|
||||
{
|
||||
"channel":
|
||||
{
|
||||
"name": "CheerLights",
|
||||
"latitude": "40.5",
|
||||
"longitude": "-80.22"
|
||||
},
|
||||
"feeds":
|
||||
[
|
||||
{
|
||||
"created_at": "2014-02-26T02:28:01Z",
|
||||
"entry_id": 11888,
|
||||
"status": "@cheerlights green"
|
||||
},
|
||||
{
|
||||
"created_at": "2014-02-26T22:05:31Z",
|
||||
"entry_id" :11889,
|
||||
"status": "@cheerlights blue"
|
||||
}
|
||||
]
|
||||
}
|
||||
</pre>
|
||||
</div>
|
||||
|
||||
<div class="format format-block-xxl format-json">
|
||||
The response will be a JSON object of Channel statuses, for example:
|
||||
|
||||
<pre class="prettyprint">
|
||||
{
|
||||
"channel":
|
||||
{
|
||||
"name": "CheerLights",
|
||||
"latitude": "40.5",
|
||||
"longitude": "-80.22"
|
||||
},
|
||||
"feeds":
|
||||
[
|
||||
{
|
||||
"created_at": "2014-02-26T02:28:01Z",
|
||||
"entry_id": 11888,
|
||||
"status": "@cheerlights green"
|
||||
},
|
||||
{
|
||||
"created_at": "2014-02-26T22:05:31Z",
|
||||
"entry_id" :11889,
|
||||
"status": "@cheerlights blue"
|
||||
}
|
||||
]
|
||||
}
|
||||
</pre>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="format format-block-xxl format-xml">
|
||||
The response will be an XML object of Channel statuses, for example:
|
||||
|
||||
<pre class="prettyprint">
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<channel>
|
||||
<name>CheerLights</name>
|
||||
<latitude type="decimal">40.5</latitude>
|
||||
<longitude type="decimal">-80.22</longitude>
|
||||
<feeds type="array">
|
||||
<feed>
|
||||
<created-at type="dateTime">2014-02-26T02:28:01Z</created-at>
|
||||
<entry-id type="integer">11888</entry-id>
|
||||
<status>@cheerlights green</status>
|
||||
<id type="integer" nil="true"/>
|
||||
</feed>
|
||||
<feed>
|
||||
<created-at type="dateTime">2014-02-26T22:05:31Z</created-at>
|
||||
<entry-id type="integer">11889</entry-id>
|
||||
<status>@cheerlights blue</status>
|
||||
<id type="integer" nil="true"/>
|
||||
</feed>
|
||||
</feeds>
|
||||
</channel>
|
||||
</pre>
|
||||
|
||||
</div>
|
||||
|
99
app/views/docs/channels/_update.html.erb
Normal file
99
app/views/docs/channels/_update.html.erb
Normal file
@ -0,0 +1,99 @@
|
||||
<div>
|
||||
<%= render 'response' %>
|
||||
<h2 id="update">Update a Channel</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> .
|
||||
|
||||
<br><br>
|
||||
Valid parameters:
|
||||
<ul>
|
||||
<li><b>api_key</b> (string) - Write API Key for this specific Channel (required). The Write API Key can optionally be sent via an X-THINGSPEAKAPIKEY HTTP header.</li>
|
||||
<li><b>field1</b> (string) - Field 1 data (optional)</li>
|
||||
<li><b>field2</b> (string) - Field 2 data (optional)</li>
|
||||
<li><b>field3</b> (string) - Field 3 data (optional)</li>
|
||||
<li><b>field4</b> (string) - Field 4 data (optional)</li>
|
||||
<li><b>field5</b> (string) - Field 5 data (optional)</li>
|
||||
<li><b>field6</b> (string) - Field 6 data (optional)</li>
|
||||
<li><b>field7</b> (string) - Field 7 data (optional)</li>
|
||||
<li><b>field8</b> (string) - Field 8 data (optional)</li>
|
||||
<li><b>lat</b> (decimal) - Latitude in degrees (optional)</li>
|
||||
<li><b>long</b> (decimal) - Longitude in degrees (optional)</li>
|
||||
<li><b>elevation</b> (integer) - Elevation in meters (optional)</li>
|
||||
<li><b>status</b> (string) - Status update message (optional)</li>
|
||||
<li><b>twitter</b> (string) - Twitter username linked to <a href="/docs/thingtweet">ThingTweet</a> (optional)</li>
|
||||
<li><b>tweet</b> (string) - Twitter status update (optional)</li>
|
||||
<li><b>created_at</b> (datetime) - Date when this feed entry was created, in the format<br>YYYY-MM-DD%20HH:NN:SS (optional)</li>
|
||||
</ul>
|
||||
|
||||
<br>
|
||||
Example POST:
|
||||
|
||||
<pre>
|
||||
POST <span class="str"><%= @ssl_api_domain %>update<span class="format format-json">.json</span><span class="format format-xml">.xml</span></span>
|
||||
api_key=<span class="customcode"><%= @channel_api_key %></span>
|
||||
field1=<span class="customcode">73</span>
|
||||
</pre>
|
||||
|
||||
<br>
|
||||
|
||||
<div class="format format-block-xl format-text">
|
||||
The response will be the entry ID of the update, for example: <code>18</code>
|
||||
<br><br>
|
||||
If the response is <code>0</code> then the update failed.
|
||||
</div>
|
||||
|
||||
<div class="format format-block-xl format-json">
|
||||
The response will be a JSON object of the new feed, for example:
|
||||
|
||||
<pre class="prettyprint">
|
||||
{
|
||||
"channel_id": 3,
|
||||
"field1": "73",
|
||||
"field2": null,
|
||||
"field3": null,
|
||||
"field4": null,
|
||||
"field5": null,
|
||||
"field6": null,
|
||||
"field7": null,
|
||||
"field8": null,
|
||||
"created_at": "2014-02-25T14:13:01-05:00",
|
||||
"entry_id": 320,
|
||||
"status": null,
|
||||
"latitude": null,
|
||||
"longitude": null,
|
||||
"elevation": null,
|
||||
"location":null
|
||||
}
|
||||
</pre>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="format format-block-xl format-xml">
|
||||
The response will be an XML object of the new feed, for example:
|
||||
|
||||
<pre class="prettyprint">
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<feed>
|
||||
<channel-id type="integer">3</channel-id>
|
||||
<field1>73</field1>
|
||||
<field2 nil="true"/>
|
||||
<field3 nil="true"/>
|
||||
<field4 nil="true"/>
|
||||
<field5 nil="true"/>
|
||||
<field6 nil="true"/>
|
||||
<field7 nil="true"/>
|
||||
<field8 nil="true"/>
|
||||
<created-at type="dateTime">2014-02-25T14:15:42-05:00</created-at>
|
||||
<entry-id type="integer">321</entry-id>
|
||||
<status nil="true"/>
|
||||
<latitude type="decimal" nil="true"/>
|
||||
<longitude type="decimal" nil="true"/>
|
||||
<elevation nil="true"/>
|
||||
<location nil="true"/>
|
||||
</feed>
|
||||
</pre>
|
||||
|
||||
</div>
|
||||
|
Reference in New Issue
Block a user