GroveStreams

GET feedrequest for specific streams529

Jefft41 private msg quote post Address this user
Is there a way to get a specific list of streams?
The "PUT feed (No JSON Body)" allows me to build a PUT for a list of feeds:
PUT /api/feed?compId=<compid>&compTmplId=Grill&compName=<compname>&api_key=<apikey>&Auger=25&RTDTemp=377&Current+Grill+Temp=321&Wifi+Signal=-50

Is there a GET equivalent to this? Possibly something like this:

GET /api/feed?compId=<compid>&compTmplId=Grill&compName=<compname>&api_key=<apikey>&Auger&RTDTemp&Current+Grill+Temp&Wifi+Signal

that would retrieve a specific list of feeds?

I've tried the
GET /api/comp/<comp>/last_value?retStreamId&api_key=<apikey>

but this returns all feeds, which is more than my receive buffer can handle. I've also tried the "limit" parameter to try to receive this list in gulps, but there's no way to get the next gulp. This request doesn't have a "start" parameter to tell it to send the next set of feeds, it always starts at the first feed even if I try to include a "start" parameter (kind of like the GET file request does).

Thanks!

Jeff
Post 1 IP   flag post
Jefft41 private msg quote post Address this user
Edit:
I'm looking for the latest feed for a list of streams, not for a list of feeds.

Thanks!

Jeff
Post 2 IP   flag post
MikeMills private msg quote post Address this user
Try looking at the advanced api GET Feed:
https://www.grovestreams.com/developers/api_adv.html

For the items parameter, you can use IDs instead of UIDs. Ensure they are URL encoded.

Set the startDate equal to the endDate to only get the last value back.
Post 3 IP   flag post
Jefft41 private msg quote post Address this user
Hi Mike,
I'll take a look.
I've found a workaround using the "PUT feed (No JSON Body)".
I can build an URL using the rsid command for each item I need,
and write a single dummy item. This returns the list that I need.
This doesn't return timestamps, but I don't require them.

Our design doesn't have a real-time clock, and doesn't store the date and time, so the startDate and endDate might be a problem.

Thanks!

Jeff
Post 4 IP   flag post
Jefft41 private msg quote post Address this user
Hi Mike,
Just getting back to this.
The "PUT feed(No JSON Body)" workaround has the unfortunate side effect of having a rate limit.

I tried your suggestion of using the advanced GET Feed for only one stream with the following results:

GET https://grovestreams.com/api/feed?startDate=4733514000000&endDate=4733514000000&api_key=<OUR API KEY>&flatten=true&itemsById=[{"compId":"F8:F0:056:75:92","streamId":"Grill+Set+Temp+Point"}]

Response:
{"feed":{"requestEndDate":4733514000000,"stream":[{"lastUpdated":1611347728049,"lastValue":180,"statistic":[{"data":[],"name":"BASE","type":"INTEGER"}],"streamType":"rdm_stream","lastValueStartDate":1611347727950,"componentUid":"f0734de8-b7b3-3667-98b0-66fb56de6568","lastValueType":"INTEGER","completedDate":1611347727951,"lastValueEndDate":1611347727951,"streamUid":"24a8cf11-56d1-3817-b793-4c103424c6d4"}],"requestStartDate":4733514000000},"success":true,"message":""}

The response is 471 characters long for just one stream!

I need to retrieve just the last value for up to 68 streams, don't need any date or stream UID information (although the stream name would be nice), and only have a 1200 byte buffer.

The "PUT feed (No JSON Body)" works perfectly except for the rate limit.

I understand the need for the rate limit on PUT, but Is there a possibility of implementing a GET equivalent to "PUT feed (No JSON Body)"?

Thanks!

Jeff
Post 5 IP   flag post
Jefft41 private msg quote post Address this user
Hi Mike,
Any word on this?

Jeff
Post 6 IP   flag post
MikeMills private msg quote post Address this user
Hi Jeff,

What's the rate limit error you're getting? Is it the more than one call within 10 seconds from the same IP address?
Post 7 IP   flag post
Jefft41 private msg quote post Address this user
Hi Mike,
Yes, I believe so.
Post 8 IP   flag post
MikeMills private msg quote post Address this user
This page describes the limits: https://www.grovestreams.com/developers/limits.html

The workaround is the X-Forwarded-For header parameter.

Set it to something unique for each call. The forum might have more information on using that parameter to avoid the 10s rule.
Post 9 IP   flag post
Jefft41 private msg quote post Address this user
I'll give that a try.

Thanks Mike!
Post 10 IP   flag post
2913 10 10
Log in or sign up to compose a reply.