[SOLVED] Error 400 and json parse error while submit data with esp8266

I am using iteaduino nano with esp8266 (esp-01) using esp8266 library from ubidots and I got http 400 while submitting to ubidots. beside http error 400 it also display {"detail": "JSON parse error - Expecting property name enclosed in double quotes: line 1 column 74 (char 73)"}

I am able to display the data sent to ubidots, this is the data :
[{"variable": "5763276b7625426909349ce2", "value":"28.10000", "context":{, }}, {"variable": "5763277376254269b8a5c72f", "value":"84.80000", "context":{, }}]

this is the whole response that display in serial console :

Response of ESP8266:
HTTP/1.1 400 BAD REQUEST
Server: nginx
Date: Sun, 19 Jun 2016 16:32:20 GMT
Content-Type: application/json
Transfer-Encoding: chunked
Connection: close
Vary: Accept
Allow: POST, OPTIONS

6e
{"detail": "JSON parse error - Expecting property name enclosed in double quotes: line 1 column 74 (char 73)"}
0

Hi @nugrahadi usually if you’re not using the context key, the correct payload should be:

[{"variable": "5763276b7625426909349ce2", "value":"28.10000"}, {"variable": "5763277376254269b8a5c72f", "value":"84.80000"}]

We’ll verify if the problem lies in Ubidots’ library and get back to you. Thanks!

Hello @nugrahadi
Thank you for the report, we fixed that problem, you can download the new version of the library, now no longer will give problems.
Best regards,
Metavix

thank you. I’ll try the updated version

@nugrahadi
No problem, I will be here if you have any issue with the new version.
Best regards,
Metavix

I still got error 400, but no json parse error this time

=>5763276b7625426909349ce2:28.30$,5763277376254269b8a5c72f:88.70$,
Response of ESP8266:
HTTP/1.1 400 Bad Request
Server: nginx
Date: Tue, 21 Jun 2016 13:33:35 GMT
Content-Type: text/html
Content-Length: 166
Connection: close

@nugrahadi

Hello, i know what is the problem now, in several minute i will update the library with the latest fix. It was what I was expecting
Best regards,
Metavix

@nugrahadi now the library works
Thank you for the patient. Download it again and try it please.
Best regards,
Metavix

thank you for the fix. after I try it, there is no error 400 this time. it says OK, but there were no update in my variables

Response of ESP8266:
OKOK
=>5763276b7625426909349ce2:28.20,5763277376254269b8a5c72f:92.30,
Response of ESP8266:

Response of ESP8266:

Response of ESP8266:

Error at CIPMODE
=>5763276b7625426909349ce2:28.20$,5763277376254269b8a5c72f:92.30$,5763276b7625426909349ce2:28.20$,5763277376254269b8a5c72f:91.40$,

Could you go to source tab and try to find if there is a data source named ESP8266 ?

yes there is data source named esp8266. is that auto generate?

@nugrahadi
Yeah i update that library. I change something, now you can save variables in Ubidots, using just the name of variable

client.add("variable_name", value);

But i will add the old method to maintain the compatibility. do you like the new method or you want the old method?
Whatever the response, I will add the old method.

Best regards,
Metavix

well, I prefer the old method. But I’ll try to use the new method for a while.

Thank you

ok than you for your answer. I think that today i will post the old method too, then i will write you to let you know.
Best regards,
Metavix