Read Published Data

The following HTTP request method allows you to retrieve all the data published in all channels.

For example, if you want read the last published data on the channel “home/fridge”, you can perform the following operation

		GET http://api.cloudplugs.com/iot/data/home/fridge?limit=1`

Please refer to Data Type for the definitions of CHMASK, PLUG_ID, TIMESTAMP, OID, etc.

Notes:

of is a REQUIRED parameter that sets the Plug_ID of the device (Production Thing/Controller) that published the data to be read.

Request

Method :

GET

Base Url :

http://api.cloudplugs.com/iot/data/CHMASK?OPTIONAL_PARAMETERS

Headers

 X-Plug-Id  : [PLUG_ID], // The Plug-id received on the response to a successful enrollment
 X-Plug-Auth: [String]   // Auth string or Connection password received on the response to a successful enrollment

Query

 id		 			= [OID];			 	// ID of the published data object
 before  			= [TIMESTAMP || OID] ;  // to retrieve data published before the timestamp or OID specified here
 after 				= [TIMESTAMP || OID] ;  // to retrieve data published after the timestamp or OID specified here
 at      			= [TIMESTAMP_CSV]    ;  // comma separated sequence of time stamps of published data
 of      			= [PLUG_ID_CSV ]     ;  // REQUIRED. Comma separated sequence of PLUG-IDs that publish data
 channel 			= [CHANNEL]		  	 ;  // optional channel
 field				= [String]			 ;  // Specific Data Field (fieldName) to retrieve data from.  If not specified, the filter to retrieve data will be applied only to data published as String or Number.
 value	    		= [String || Number || Boolean ] // value used to create filters to retrieve data published in "field" (e.g. = "value")
 valueLess			= [String || Number ];	// used to retreive "field" data if it is < "value"
 valueLessEqual		= [String || Number ];	// used to retreive "field" data if it is <= "value"
 valueGreater		= [String || Number ];  // used to retreive "field" data if it is > "value"
 valueGreaterEqual	= [String || Number ];  // used to retreive "field" data if it is >= "value"
 offset  			= [N]                ;  // offset of data with respect to the last published data
 limit  			= [N]  // if you set this parameter to 1, the response will contain the last published data on the first Channel matched by CHMASK

Response

Status

200 OK

Body

 [{
   "id"        : [OID],
   "channel"   : [CHANNEL],     
   "data"      : [JSON],   
   "at"        : [String],    
   "of"        : [String],
   "expire_at" : [TIMESTAMP]
 },...]						// array of objects
Still need help? Get in touch!
Last updated on 6th May 2021