Jump to content









Photo

Get latest Stream data


  • Please log in to reply
4 replies to this topic

#1 archit2112

archit2112

    Newbie

  • Members
  • Pip
  • 5 posts

Posted 02 July 2014 - 05:20 AM

I used this Rest call -

 

http://api.carriots..../streams/?max=1

 

This showed me the oldest streamed data. I want to retrieve the lastest streamed data. How do I achieve this?

Thanks in advance.



#2 sdeancos

sdeancos

    Master of Puppets

  • Members
  • PipPipPip
  • 107 posts
  • LocationMadrid, Spain.

Posted 02 July 2014 - 05:48 AM

Hello!

 

You can try use a sort and order params:

 

sort (optional) Field name.
Sort the result by the given field. Default value is device.
Example: creation_date    

order (optional)

Integer. Valid values: -1 or 1
Result order criteria: -1 for descending and 1 for ascending.
Example: -1

 

 

for example:

 

.../.../?sort=at&order=-1



#3 archit2112

archit2112

    Newbie

  • Members
  • Pip
  • 5 posts

Posted 02 July 2014 - 06:37 AM

Hello!

 

You can try use a sort and order params:

 

sort (optional) Field name.
Sort the result by the given field. Default value is device.
Example: creation_date    

order (optional)

Integer. Valid values: -1 or 1
Result order criteria: -1 for descending and 1 for ascending.
Example: -1

 

 

for example:

 

.../.../?sort=at&order=-1

This totally worked! thanks a lot



#4 arushakelkar

arushakelkar

    Newbie

  • Members
  • Pip
  • 3 posts

Posted 11 June 2018 - 10:48 AM

How to check field in the url itself i.e. if the field is present in the data part of the stream or not



#5 sdeancos

sdeancos

    Master of Puppets

  • Members
  • PipPipPip
  • 107 posts
  • LocationMadrid, Spain.

Posted 11 June 2018 - 05:11 PM

Hi

You can try use a _contains filter in query string. For example, get only streams with key temperature in data:

 

 

https://api.carriots.com/devices/MyAwesomeDevice@IDD.IDD/streams/?_contains[]=temperature

 

 

 

BR






2 user(s) are reading this topic

0 members, 2 guests, 0 anonymous users