Get Channel Feeds September 29, 2017


The Get Channel Feeds API is used to read the data feed from all the sensor fields in a channel. This method can return either a JSON or CSV object.

If you only need to access the latest readings from the channel, using the Get Channels API is recommended.  It will return latest readings from all the channels in once. 


To return a JSON object:

To return a CSV file:

Where CHANNEL_ID is the ID of the target channel.

HTTP Method


URL Parameters

Name Type Required Description
api_key or token_id String Required for private channels Specify the API write key or read key of the channel, or token_id obtained after the user logged in.
results Integer Optional Number of entries to retrieve. The maximum number is 8,000
entry_id Boolean Optional Include entry_id for each record by setting “entry_id=true”. Default is false.
start Datetime Optional Start date in format YYYY-MM-DD%20HH:NN:SS.
end Datetime Optional End date in format YYYY-MM-DD%20HH:NN:SS.
field String Optional Only selected field name will be returned. E.g. field=field2, does not work with sum and average options.
status Boolean Optional Include status updates in the feed by setting “status=true”.
metadata Boolean Optional Include metadata for a channel by setting “metadata=true”.
timezone String Optional Identifier from Time Zones Reference for this request.
min Decimal Optional Minimum value to include in response.
max Decimal Optional Maximum value to include in response.
sum String Optional Get sum of this many minutes, valid values: 10, 15, 20, 30, 60, 240, 720, 1440, “daily”.
average String Optional Get average of this many minutes, valid values: 10, 15, 20, 30, 60, 240, 720, 1440, “daily”.
round Integer Optional Round to this many decimal places.
callback String Optional Function name to be used for JSONP cross-domain requests.
fahrenheit Boolean Optional Convert temperature reading from default Celsius to Fahrenheit in the response by setting “fahrenheit=true”.


200 Success. Body contains a JSON object with the feeds data in the requested format.  If is_truncated is presented in the response JSON and value is true, it means the result has been truncated because of the maximum number of entries for retrieving has been reached. You can change the start and end value to shrink the range.

Error: See the list of error codes for details.



The response is a JSON object, for example:


PHP Quickstarts

// +----------------------------------------------------------------------
// | UbiBot
// +----------------------------------------------------------------------
// | Copyright (c) 2016-2019 All rights reserved.
// +----------------------------------------------------------------------
// | Author: UbiBot <[email protected]>
// +----------------------------------------------------------------------
// Get Channel Feeds
// To view a channel feed, send an HTTP GET replacing CHANNEL_ID with the ID of your channel
//yours channel read key, can be obtained from web console panel
$apikey = "XXXXXXX";

$channel_id = 'XXXXXX'; //channel ID of your device
$url = ''.$channel_id.'/feeds';

$params = array(
		"api_key" => $apikey,// (string) is Read or Write key for this specific channel (no key required for public channels) 
 		"results" => 30,//(integer) Number of entries to retrieve, 8000 max (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)
// 		"min" => "",//(decimal) Minimum value to include in response (optional)
// 		"max" => "",//(decimal) Maximum value to include in response (optional)
// 		"sum" => "",//(integer or string) Get sum of this many minutes, valid values: 10, 15, 20, 30, 60, 240, 720, 1440, "daily" (optional)
// 		"round" => "",//(integer) Round to this many decimal places (optional)
// 		"average" => "",//(integer or string) Get average of this many minutes, valid values: 10, 15, 20, 30, 60, 240, 720, 1440, "daily" (optional)
// 		"timezone" => "",//(string) Identifier from Time Zones Reference for this request (optional)
// 		"callback" => "",//(string) Function name to be used for JSONP cross-domain requests (optional)
$paramstring = http_build_query($params);
$content = getcurl($url,$paramstring);
$result = json_decode($content,true);


    	$result['channel']['vconfig'] = json_decode($result['channel']['vconfig'],true);
    	//Filter channels that need to be displayed
    	$filter_fields = array('field1','field2','field3','field4','field5','field6','field7','field8','field9','field10');
    	//Sensor unit
    	$unit = array('temperature_celcius','temperature_feh','humidity','light_lux','voltage','WIFI_dbm','vibration','knocks','magnetic_switch','soil_absolute_moisture');
    	$list = array();
    	foreach ($filter_fields as $value) {
    		$list[$value]['name'] = $result['channel'][$value];
    		if (isset($result['channel']['vconfig'][$value])) {
    			$list[$value]['show'] = $result['channel']['vconfig'][$value]['h']?0:1;
    			$list[$value]['unit'] = $unit[$result['channel']['vconfig'][$value]['u']];
    		} else {
    			$list[$value]['show'] = 0;
    			$list[$value]['unit'] = null;
    	foreach ($result['feeds'] as $value) {

    		foreach ($value as $k => $val) {
    			$tmp = array();
    			if (in_array($k, $filter_fields)) {

    				$tmp['value'] = $value[$k];
    				$tmp['created_at'] = $value['created_at'];
    				$list[$k]['data'][] = $tmp;
        echo $result['errorCode'].":".$result['desp'];

    echo "failed";
echo '<pre>';

 * @param  string $url
 * @param  string $params 
 * @param  int $ispost 
 * @return  string
function getcurl($url,$params=false,$ispost=0){
    $httpInfo = array();
    $ch = curl_init();
    curl_setopt( $ch, CURLOPT_HTTP_VERSION , CURL_HTTP_VERSION_1_1 );
    curl_setopt( $ch, CURLOPT_USERAGENT , 'JuheData' );
    curl_setopt( $ch, CURLOPT_CONNECTTIMEOUT , 60 );
    curl_setopt( $ch, CURLOPT_TIMEOUT , 60);
    curl_setopt( $ch, CURLOPT_RETURNTRANSFER , true );
    curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
    if( $ispost )
        curl_setopt( $ch , CURLOPT_POST , true );
        curl_setopt( $ch , CURLOPT_POSTFIELDS , $params );
        curl_setopt( $ch , CURLOPT_URL , $url );
            curl_setopt( $ch , CURLOPT_URL , $url.'?'.$params );
            curl_setopt( $ch , CURLOPT_URL , $url);
    $response = curl_exec( $ch );
    if ($response === FALSE) {
        //echo "cURL Error: " . curl_error($ch);
        return false;
    $httpCode = curl_getinfo( $ch , CURLINFO_HTTP_CODE );
    $httpInfo = array_merge( $httpInfo , curl_getinfo( $ch ) );
    curl_close( $ch );
    return $response;

	<style type="text/css">
            border-collapse: collapse;
            border: none;
            width: 100%;
            border: solid #000 1px;
        li{ display:inline} 
 	 		<th>Sensor name</th>
 	 	<?php foreach ($list as $key => $value) :?>
 	 			<td><?php echo $key;?></td>
				<td><?php echo $value['name'];?></td>
				<td><?php echo $value['show']?'Yes':'No';?></td>
				<td><?php echo $value['unit'];?></td>
				<td style="text-align: left;">
				<?php if (empty($value['data'])) :?>
					No data
				<?php else :?>
					<?php foreach ($value['data'] as $val):?>
						<li><?php echo $val['created_at'];?></li>
						<li style="margin-left:20px;"><?php echo $val['value'];?></li>
					<?php endforeach;?>
				<?php endif;?>
 	 	<?php endforeach;?>