[SOLVED] [{"status_code": 400}]


#1

I have a demo running, having sent test data to my account for the last few days. I have been leaving my test device on to see if any reliability issues pop up.

This morning at 04:49 Southern African Time the server suddenly started giving this result, without me having changed anything to my code. I have gone through the syntax a thousand times, I cannot see a mistake. The error is for invalid JSON syntax:
[{“status_code”: 400}]

The request looks like this:
[{“variable”: “5ab8ed95642ab656b0020ca1”, “value”:43.55}, {“variable”: “5abe2436642ab63508b67c93”, “value”:17}]

And the server response:
HTTP/1.1 200 OK
Server: nginx
Date: Wed, 04 Apr 2018 18:09:38 GMT
Content-Type: application/json
Transfer-Encoding: chunked
Connection: keep-alive
Vary: Cookie
Allow: POST, OPTIONS

2c
[{“status_code”: 400}, {“status_code”: 400}]
0


#2

Greetings, please make sure that you are using this endpoint:

http://things.ubidots.com/api/v1.6/collections/values

A 400 error means a wrong request and it is related to a wrong endpoint or a wrong payload.

All the best


#3

Sure am!

POST /api/v1.6/collections/values/?token=xxxxx HTTP/1.1
Host: things.ubidots.com
Content-Type: application/json
Content-Length: 363


#4

Anyone have an idea?


#5

I suspect that your device may be creating wrong payloads but I am not sure where your error may be, If the error was related with the service you should get a 500 response code, but a 400 for sure means a wrong request from your device. Can you try to send your payload from another device to discard any issue in its construction during a day?


#6

Hi.

I have tested using old sections of code that I definitely know DID WORK to send data to your server successfully, and even these give the same error 400.

Could someone PLEASE look into this for me, if there may be an issue with my account. The very day that you guys manually removed a “demo” user from my account was the same day that this error occurred.

Things were working perfectly with the code I used but suddenly NONE of my previously used code works anymore. I’m testing your platform before we upgrade to a commercial account, but I’ve now been stuck right here for almost a week with no usable feedback from customer support - if we cannot get past this it will be impossible to use Ubidots as a business platform.


#7

Is there a way for users to access and view the payloads as they are received by the server? It would be a tremendous help if users could see what actually ends up at the server.


#8

Please write to support@ubidots.com with the TOKEN that your device is using and the data range that you wish to retrieve for the JSON log so we can export it for you.

All the best


#9

After getting the JSON log (thanks) I was able to confirm that my payloads were indeed CORRECT. And your server still accepted the POST requests, but giving a 400 response to any and all attempts to update variables. I have spent a week changing and rechanging code, using old code that I know worked when it was used, but the same result.

So I just created a dummy account, used its token and one variable I just created, ran my code and it works like normal, just as it did before the problem arrived. Changed it back to my existing token and variable, and the problem is back. Now if I copy and paste the token and variable API label directly from the “devices” tab into my code and your server gives me this error, it tells me there is a problem connected to my account specifically.

And as I mentioned at the start of this thread: THE PROBLEM STARTED IN THE MIDDLE OF THE NIGHT, WHILE MY DEVICE WAS RUNNING THE EXACT SAME CODE FOR SEVERAL DAYS. It worked for several days and suddenly, without me changing any code, your server suddenly started responding with [{“status_code”: 400}] instead of [{“status_code”: 201}].

As someone who is still trying out your services before I make a commercial commitment this is VERY worrying. In other words, the variables that I have set up, and which I have been using, is now non-existent, even though they appear in my devices lists.


#10

Greetings, can you share with me via the embedded chat the timestamp when you get the 400 error in order to check? Your issues seem to be very particular as we do not have any report like this from any of our actual users.

All the best


#11

I deleted all the variables that were “dead” and created a new device with new variables. It all works now. I am sorry I deleted these ones because I was able to replicate the problem using their variable labels.

I suspect it had something to do with the fact that you had to remove the user “demo” manually from my account, because it was on this same day that this issue came up.

So basically I was using the correct variable labels as found in my device list, but your system did not recognise them whenever I sent a correct payload containing any of those variables.