<%= render 'response' %>
Get a Channel Feed
To view a Channel feed, send an HTTP GET to <%= @ssl_api_domain %>channels/CHANNEL_ID/feeds.json.xml
,
replacing CHANNEL_ID with the ID of your Channel.
Valid parameters:
- api_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)
- metadata (true/false) Include Channel's metadata by setting "metadata=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/feeds.json.xml?results=2
The response will be an HTML page with the JSON Channel 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",
"field2": "25.902335456475583"
},
{
"created_at": "2014-02-26T12:43:04-05:00",
"entry_id": 6060625,
"field1": "164",
"field2": "25.222929936305732"
}
]
}
Live examples:
<%= render 'response' %>
Get Last Entry in a Channel Feed
To get the last entry in a Channel feed, send an HTTP GET to <%= @ssl_api_domain %>channels/CHANNEL_ID/feeds/last.json.xml
,
replacing CHANNEL_ID with the ID of your Channel.
Valid parameters:
- api_key (string) Read API Key for this specific Channel (optional--no key required for public channels)
- 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)
- callback (string) Function name to be used for JSONP cross-domain requests (optional)
Example GET:
GET <%= @ssl_api_domain %>channels/9/feeds/last.json.xml
The response will be a JSON object of the most recent feed, for example:
{
"created_at": "2014-02-26T21:27:21Z",
"entry_id": 6061519,
"field1": "176",
"field2": "28.195329087048833"
}
<%= render 'response' %>
Get Specific Entry in a Channel
To get a specific entry in a Channel's feed, send an HTTP GET to <%= @ssl_api_domain %>channels/CHANNEL_ID/feeds/ENTRY_ID.json.xml
,
replacing CHANNEL_ID with the ID of your Channel and ENTRY_ID with the ID of your entry.
Valid parameters:
- api_key (string) Read API Key for this specific Channel (optional--no key required for public channels)
- 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)
- callback (string) Function name to be used for JSONP cross-domain requests (optional)
Example GET:
GET <%= @ssl_api_domain %>channels/9/feeds/6061519.json.xml
The response will be a JSON object of the feed entry, for example:
{
"created_at": "2014-02-26T21:27:21Z",
"entry_id": 6061519,
"field1": "176",
"field2": "28.195329087048833"
}