[SOLVED] HTTP API: strange response in chunked format

Hello

I’m using an STM32 device with custom C code to connect to Ubidots cloud with HTTP API.
Last week I was able to change and read variables.
Today I’m getting different response from app.ubidots.com: it is in HTTP chunked format and the content is always:

{“count”: true, “previous”: null, “results”: [], “next”: null}

either PUT or GET on a variable gives same result.

Is there a problem in Ubidots server ?

Thanks,

Bill

Hello @bill38,

As I can see the endpoint you are using is app.ubidots.com and the proper endpoint is things.ubidots.com. Please, can you try again assigning the proper endpoint and let us know the behavior?

For more information, see here.

All the best,
Maria C.

I changed the endpoint to things.ubidots.com. Then the result was HTTP error 403.

I noticed I was doing an HTTP PUT instead of a POST so I modified my code to do a POST and it worked.

I still wonder if it’s possible to have a response not in chunked format ?

After modifying the endpoint to things.ubidots.com and change the PUT request to POST are you still getting the chunked format? If the result of the HTTP request is 200 you should get the succesfull response for each value sent.

Yes, I still get the chunked format. The result of the request is 200.

Also it seems when changing multiple variables in same request, the HTTP response takes a long time to come (> 10 seconds).

Can you provided us how your are building the request? This will helpful for use to verify the behavior presented by your side.

Here’s the request (I’ve deleted my device label and token ):

GET /api/v1.6/devices/xxxxx/led/lv HTTP/1.1
Host: things.ubidots.com
Content-Type: application/json
Content-Length: 0
X-Auth-Token: yyyyyyyyy

and the answer:

HTTP/1.1 200 OK
Server: nginx
Date: Mon, 26 Feb 2018 16:36:03 GMT
Content-Type: application/json
Transfer-Encoding: chunked
Vary: Accept-Encoding
Vary: Cookie
Allow: GET, HEAD, OPTIONS

3
0.0
0

That is the default response from the server. To get just the last value you should parse the response obtained, to make something useful with the value. In other case, if you desire to get just the last value I recommend you use MQTT.

All the best,
Maria C.