thingspeak/app/views/docs/channels/_update.html.erb

106 lines
3.6 KiB
Plaintext
Raw Normal View History

2014-02-28 19:57:58 +01:00
<div>
<%= render 'response' %>
2014-07-02 17:46:04 +02:00
<h2 id="update">Update a Channel</h2>
2014-02-28 19:57:58 +01:00
</div>
<br>
2014-07-02 17:46:04 +02:00
To update a Channel, send an HTTP PUT to
<br><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> .
2014-02-28 19:57:58 +01:00
<br><br>
Valid parameters:
<ul>
2014-07-02 17:46:04 +02:00
<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>
2014-02-28 19:57:58 +01:00
<li><b>elevation</b> (integer) - Elevation in meters (optional)</li>
2014-07-02 17:46:04 +02:00
<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>metadata</b> (text) - Metadata for the Channel, which can include JSON, XML, or any other data (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>tags</b> (string) - Comma-separated list of tags (optional)</li>
<li><b>url</b> (string) - Webpage URL for the Channel (optional)</li>
2014-02-28 19:57:58 +01:00
</ul>
<br>
2014-07-02 17:46:04 +02:00
Example PUT:
2014-02-28 19:57:58 +01:00
<pre>
2014-07-02 17:46:04 +02:00
PUT <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>
name=<span class="customcode">Updated Channel</span>
2014-02-28 19:57:58 +01:00
</pre>
<br>
2014-07-02 17:46:04 +02:00
<div class="format format-block-xxl format-text">
The response will be a webpage with your updated Channel.
2014-02-28 19:57:58 +01:00
</div>
2014-07-02 17:46:04 +02:00
<div class="format format-block-xxl format-json">
The response will be a JSON object of the updated channel, for example:
2014-02-28 19:57:58 +01:00
<pre class="prettyprint">
{
2014-07-02 17:46:04 +02:00
"id": 4,
"name": "Updated Channel",
"description": null,
"metadata": null,
2014-02-28 19:57:58 +01:00
"latitude": null,
"longitude": null,
2014-07-02 17:46:04 +02:00
"created_at": "2014-03-25T13:12:50-04:00",
2014-02-28 19:57:58 +01:00
"elevation": null,
2014-07-02 17:46:04 +02:00
"last_entry_id": null,
"ranking": 15,
"username": "hans",
"tags": [],
"api_keys":
[
{
"api_key": "XXXXXXXXXXXXXXXX",
"write_flag": true
}
]
2014-02-28 19:57:58 +01:00
}
</pre>
</div>
2014-07-02 17:46:04 +02:00
<div class="format format-block-xxl format-xml">
The response will be an XML object of the updated channel, for example:
2014-02-28 19:57:58 +01:00
<pre class="prettyprint">
&lt;?xml version="1.0" encoding="UTF-8"?>
2014-07-02 17:46:04 +02:00
&lt;channel>
&lt;id type="integer">4&lt;/id>
&lt;name>Updated Channel&lt;/name>
&lt;description nil="true" />
&lt;metadata 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;api-keys type="array">
&lt;api-key>
&lt;api-key>XXXXXXXXXXXXXXXX&lt;/api-key>
&lt;write-flag type="boolean">true&lt;/write-flag>
&lt;/api-key>
&lt;/api-keys>
&lt;/channel>
2014-02-28 19:57:58 +01:00
</pre>
</div>