<%= render 'response' %>
Get a Channel Field Feed
To view a Channel's field feed, send an HTTP GET to <%= @ssl_api_domain %>channels/CHANNEL_ID/fields/FIELD_ID.json.xml
,
replacing CHANNEL_ID with the ID of your Channel and FIELD_ID with the ID of your field.
Valid parameters:
- key (string) Read API Key for this specific Channel (optional--no key required for public channels)
- results (integer) Number of entries to retrieve, 8000 max, default of 100 (optional)
- days (integer) Number of 24-hour periods before now to include in feed (optional)
- start (datetime) Start date in format YYYY-MM-DD%20HH:NN:SS (optional)
- end (datetime) End date in format YYYY-MM-DD%20HH:NN:SS (optional)
- timezone (string) Timezone identifier for this request (optional)
- offset (integer) Timezone offset that results should be displayed in. Please use the timezone parameter for greater accuracy. (optional)
- status (true/false) Include status updates in feed by setting "status=true" (optional)
- location (true/false) Include latitude, longitude, and elevation in feed by setting "location=true" (optional)
- min (decimal) Minimum value to include in response (optional)
- max (decimal) Maximum value to include in response (optional)
- round (integer) Round to this many decimal places (optional)
- timescale (integer or string) Get first value in this many minutes, valid values: 10, 15, 20, 30, 60, 240, 720, 1440, "daily" (optional)
- sum (integer or string) Get sum of this many minutes, valid values: 10, 15, 20, 30, 60, 240, 720, 1440, "daily" (optional)
- average (integer or string) Get average of this many minutes, valid values: 10, 15, 20, 30, 60, 240, 720, 1440, "daily" (optional)
- median (integer or string) Get median of this many minutes, valid values: 10, 15, 20, 30, 60, 240, 720, 1440, "daily" (optional)
- callback (string) Function name to be used for JSONP cross-domain requests (optional)
Please note that the results parameter is not compatible with timescale, sum, average, or median.
Example GET:
GET <%= @ssl_api_domain %>channels/9/fields/1.json.xml?results=2
The response will be an HTML page with the JSON Channel's field feed, for example:
{
"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"
}
]
}
<%= render 'response' %>
Get Last Entry in a Field Feed
To get the last entry in a Channel's field feed, send an HTTP GET to <%= @ssl_api_domain %>channels/CHANNEL_ID/fields/FIELD_ID/last.json.xml
,
replacing CHANNEL_ID with the ID of your Channel and FIELD_ID with the ID of your field.
Valid parameters:
Example GET:
GET <%= @ssl_api_domain %>channels/9/fields/1/last.json.xml
The response will be the Channel field's most recent value, for example:
176