Sigfox callback error 400 when sending data to losant url


#1

when i load variables in sigfox body

{
  "device" : "{device}",
  "data" : "{data}",
  "rssi" : {rssi}
}

it is throwing “error 400” but when i send without putting anything in body.Data is send losant server without any error.


#2

How are you connecting SigFox to Losant? Are you using a webhook? I had some issues learning how to get SigFox to connect with Losant, but I figured it out and it’s working pretty well. Your JSON looks good at this glance (and SigFox backend validates it when you click Ok to save), so it might be something else. I am assuming you are getting the Red callback arrow in the SigFox backend when your transmit comes in.


#3

yes i am getting red arrow when transmit come in.Yes i am using webhook.when i send data through “header” "value " insted of using body json format it arraves at losent dashboard.


#4

I didn’t use any values in the URL pattern, just pasted the Losant webhook into the field. I just put the content as json in the body like you have in your post. In Sigfox I use the HTTP method POST, click the Send SNI box for SSL, keep header value fields blank and set content type to application/json. I’ve never messed with the header/value fields in the SigFox backend, but I’ve never used them for anything with SF that I have done. I’m also not doing any authentication in my webhook, but that might be something I want to explore sometime soon.

Hopefully that helps. Just so you know I’m just another Losant user, so working to learn more about this platform as I go!


#5

Thanks for your help .I am doing same but anyhow getting error don,t know why.


#6

400 is the status code for “Bad Request”, which likely means the body is not rendering to valid JSON. The first thing I might try is wrapping the rssi with quotes. In theory, that should be a number, and resolve to valid JSON, but it could be something else.

{
  "device" : "{device}",
  "data" : "{data}",
  "rssi" : "{rssi}"
}

The guide that we published does wrap the rssi value in quotes, so that’s when we do internally. Give that a try and let me know if you’re still seeing an issue.


#7

Hi Brandon,
Thanks for your reply.i have tried that way also but it is not working


#8

Well, that is interesting. Can you please paste a screenshot of where you’re seeing the 400?


#9

Another thing to check is to make sure the Content Type is set to application/json in the callback configuration. It does not default to json, so it may need changed.


#10

i am doing exaclty same let me send u pic


#11


#12

Can you do me a favor and change the URL to https://requestb.in/1i4bony1. This will allow me to see the raw data being transferred.


#13

Hello are you there?can we test it now .Sorry i was unable to reply tomorrow


#14

Whenever you get a chance, please create a RequestBin URL yourself and change the Sigfox callback to that URL. RequestBin is a helpful service that will display any raw information sent to it. That will allow us to inspect the data being sent from the Sigfox backend to see any potential errors.

https://requestb.in/