GroveStreams
seckford private msg quote post Address this user
Until recently I've been using a string from the GroveStreams Arduino
example to update a GroveStream organisation, with the form:
sprintf(urlBuf, "PUT /api/feed?compTmplId=%s&compId=%s&compName=%s&api_key=%s%s HTTP/1.1",
gsComponentTemplateId, myMac, gsComponentName, gsApiKey, getSamples());

However, when editing things recently I found that the terminal
HTTP/1.1 was taken as part of the reading, which became the string
'+24.00 HTTP/1.1' instead of just the number '+24.00' (even if
the data type was set to float). There's a note somewhere which says
that any parameter which is part of the URL has to be url-encoded,
but a trailing space has worked up to now. The URL updates correctly
if the HTTP/1.1 is removed; what's its purpose, and is it essential?

Thanks - C W Rose
Post 1 IP   flag post
MikeMills private msg quote post Address this user
I'm not sure if "HTTP/1.1" is required. I can't find anywhere where it says it is or isn't, but almost every example I've found has it on there.

Can you turn on API tracing and post here (without your api_Key) what is arriving?
Post 2 IP   flag post
seckford private msg quote post Address this user
Yes, I can get at the system this weekend and will let you know.

Thanks - C W Rose
Post 3 IP   flag post
seckford private msg quote post Address this user
The trailing HTTP/1.1 is required by RFC 7230 section 3.1. I'm pretty sure
the problem came in the move from an Arduino program in C, which sends the
request string as it is composed, to a NodeMCU program in Lua which uses
a slightly tricky API. I've finally come to terms with NodeMCU, and the
GroveStreams component seems to be updating successfully with the
HTTP/1.1 string attached.

Thanks for your help - C W Rose
Post 4 IP   flag post
2965 4 4
Log in or sign up to compose a reply.