GroveStreams
kevin private msg quote post Address this user
Does anybody have the experience that how to use httpie to PUT some data to Grovestreams? My test command is as below.

http PUT http://grovestreams.com/api/feed compId=comp1 data=1 api_key=...

The response is always "401 Unauthorized".
It's appreciated if the sample command of httpie for Grovestreams can be provided? Thanks!
Post 1 IP   flag post
MikeMills private msg quote post Address this user
You can get a 401 if your URL is malformed and we can't parse out the api_key. I'm new to httpie. It appears they have an online tester. I'll see if I can get PUT working there and get back...
Post 2 IP   flag post
MikeMills private msg quote post Address this user
This should work:

http -v PUT grovestreams.com/api/feed Content-type:application/json Accept:application/json compId==ID123 temp==32.5 wind==4 winddir==sw api_key==XXXx-XX-XX-XX-XXXX

But I get this when using their online console:
Failed to establish a new connection: [Errno -2] Name or service not known

It doesn't work when I put in our IP address either (don't ever do that in production).

I tried doing a simple GET with some well known domains...same error. So this could indicate an issue with their service.

I checked our (grovestreams) server logs. Their calls made it a couple of times when I first started, then nothing appeared in the logs after that.

Looks like I matched their example.

Maybe their service is having issues or the online console isn't working. I'm clueless.
Post 3 IP   flag post
kevin private msg quote post Address this user
Thanks a lot for your effort. Actually I have a Sigfox device and I want to forward Sigfox message to GroveStreams via Sigfox backend server. It failed, so I use httpie to try first.

In the Sigfox backend server, it allows to register custom callback. It supports http PUT, but the content type only support "application/x-www-form-urlencoded". The complete messages and response are as below, still authentication failed. It is possible to upload the data to your server in this way by http?


401 - Unauthorized - #1
PUT http://grovestreams.com/api/feed HTTP/1.0
content-length : 69
accept-encoding : gzip,deflate
accept-language : fr
host : grovestreams.com
user-agent : SIGFOX
accept-charset : UTF-8;q=0.9,*;q=0.7
content-type : application/x-www-form-urlencoded

compId=Sensors&temp=24.5&api_key=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
Post 4 IP   flag post
MikeMills private msg quote post Address this user
I don't think we'll accept a x-www-form-urlencoded type. Maybe try not setting the content-type to see if anything will get through.

Usually, 401 will indicate that your api_key is invalid or we can't parse the URL to get extract the api_key. But...

I searched our server logs for "compId=Sensors&temp=24.5" and nothing came up so I don't even think the call is making it to our servers. Try it again with a compId to something unique and I'll search the logs again. I didn't search archived logs; I would like to search current logs with a unique identifier.
Post 5 IP   flag post
2748 5 5
Log in or sign up to compose a reply.
destitute