Sigfox bad request

Hi,

I’m using a Sigfox sensor with Sigfox Network Emulator. I have configured the callback following the documentation https://docs.tago.io/en/articles/33 and have created a custom sigfox device on TagoIO with own parser but I kept the default own parser program. The authorization is created and added in Sigfox callback header.
The Sigfox screen display a callback error (400 bad request) and in sigfox snek log, there is this message :
Callback ‘cb_data’ : ‘CallbackData(time=1631871262.0, device=‘yyyyyy’, duplicate=False, snr=50.0, avgSnr=50.0, rssi=-25.079999923706055, station=‘0000’, LQI=‘GOOD’, data=‘d00005c106000000000000’, seqNumber=1603, ack=False, freq=868187869.0, trame_number=1)’
2021-09-17 11:34:23,819 - INFO - HTTP call (POST) to the SI client: https://sigfox.middleware.tago.io/uplink with data: [{
“variable”: “device”,
“value”: “yyyyyy”,
“serie”: “1631871262.0”
},{
“variable”: “data”,
“value”: “d00005c106000000000000”,
“serie”: “1631871262.0”
},{
“variable”: “seqNumber”,
“value”: “1603”,
“serie”: “1631871262.0”
}] and headers: {‘authorization’: ‘xxxxxxxxxxxxxxxxxxxxxx’, ‘device’: ‘{device}’, ‘Content-type’: ‘application/json’}
2021-09-17 11:34:24,161 - INFO - Client response: {“status”:false,“error”:“missing param device”}
2021-09-17 11:34:24,162 - INFO - SI Client response’<ClientResponse(https://sigfox.middleware.tago.io/uplink) [400 Bad Request]>

I’ve replaced Device ID and authorization key by letters.
Could you help me please ?

Hi @plegarff

Welcome to our community! We’re glad to have you here. :partying_face:

Soon our team or a user will help you with this query.

Best regards!

Phil Gutierre
Customer Support

hi @plegarff,

All step that you did seems right. But, the error “missing param device” means that your header “device” is coming null or empty. Check the emulator documentation if it works the same as the Sigfox backend callback.

Your request must be like:
POST: https://sigfox.middleware.tago.io/uplink
headers:
device: {device}
authorization: your_authorization
body:
[{
“variable”: “device”,
“value”: “{device}”,
“serie”: “{time}”
},{
“variable”: “data”,
“value”: “{data}”,
“serie”: “{time}”
},{
“variable”: “seqNumber”,
“value”: “{seqNumber}”,
“serie”: “{time}”
}]

NOTE: {device} is to get the current id dynamically (I don’t know if it works with the emulator)

If it doesn’t help, please open a ticket on TagoIO support and give the details there (like device id and etc).

Hi eger,

Thank you for your answer.
Effectively, I’ve found this in emulator documentation :
Variables cannot be used in header keys because the format is standardized.
and " For security reasons, we disallow all standards headers except Authorization ."
Replace variable device by device ID doesn’t work which seems logical.
I’ve removed device header and tried this syntax that can be used to pass variables but it doesn’work no more :
https://sigfox.middleware.tago.io/uplink?device={device}
That gives this in log :
Callback ‘cb_data’ : ‘CallbackData(time=1632149659.0, device=‘yyyyyy’, duplicate=False, snr=50.0, avgSnr=50.0, rssi=-16.90999984741211, station=‘0000’, LQI=‘GOOD’, data=‘d00005c106000000000000’, seqNumber=2147, ack=False, freq=868187866.0, trame_number=1)’
2021-09-20 16:54:19,429 - INFO - HTTP call (POST) to the SI client: https://sigfox.middleware.tago.io/uplink with data: device=yyyyyy&[{
“variable”: “device”,
“value”: “yyyyyy”,
“serie”: “1632149659.0”
},{
“variable”: “data”,
“value”: “d00005c106000000000000”,
“serie”: “1632149659.0”
},{
“variable”: “seqNumber”,
“value”: “2147”,
“serie”: “1632149659.0”
}] and headers: {‘Content-type’: ‘application/json’, ‘authorization’: ‘xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx’}
Should I open a ticket even so ?

hi @plegarff,

the parameter won’t work, because the Sigfox middleware has been developed to work with the sigfox backend and only expect to receive the device Id the the header. I’ll talk to the team and check if we can add this support to the middleware (use {device} in parameters) and let you know.

Thx,
Fabiano Eger,
Software developer at TagoIO

Thanks Fabiano.
I hope it would be possible.
Regards.
Patrice

hi @plegarff,

We made an update in the middleware to be able to receive requests passing “device” in parameter.

Please, test your uplink now.

1 Like

Hi,
Thank-you for your prompt response.
But it doesn’t work (same error 400 with log message :“missing param device”).
Below my Sigfox callback configuration :


Do I have something to modify on my TagoIO configuration ?

Can you send the request details, I mean what’s coming in the params. Because this error means that the device ID is not being sent in the request yet.

Here is the details (snek log). I ‘ve just replaced the authorization this time.

2021-09-23 21:56:43,212 - INFO - Message frame received: Device:0XCE8E7C, Timestamp:2021-09-23 21:56:42, Raw: [6, 78, 124, 142, 206, 0, 208, 0, 5, 194, 12, 2, 0, 2, 0, 1, 0, 249, 181, 53], Frame-Seq: 2, Seq: 1614, Snr: 50.0, Res: 0, Payload: b’\xd0\x00\x05\xc2\x0c\x02\x00\x02\x00\x01\x00\xf9’, Hmac: [181, 53], Frequency: 868136471.0, Version: 2, Ack: 0, Rssi: -25.100000381469727, Length: 26, Oob: 0, Data: [208, 0, 5, 194, 12, 2, 0, 2, 0, 1, 0, 249], Data-Size: 20,

2021-09-23 21:56:43,213 - INFO - Message sent to backend

2021-09-23 21:56:43,214 - INFO - send callback to client ‘CallbackData(time=1632427002.0, device=‘ce8e7c’, duplicate=False, snr=50.0, avgSnr=50.0, rssi=-25.100000381469727, station=‘0000’, LQI=‘GOOD’, data=‘d00005c20c020002000100f9’, seqNumber=1614, ack=False, freq=868136471.0, trame_number=2)’

2021-09-23 21:56:43,214 - INFO - Try to communicate with the client for the first try.

Callback ‘cb_data’ : ‘CallbackData(time=1632427002.0, device=‘ce8e7c’, duplicate=False, snr=50.0, avgSnr=50.0, rssi=-25.100000381469727, station=‘0000’, LQI=‘GOOD’, data=‘d00005c20c020002000100f9’, seqNumber=1614, ack=False, freq=868136471.0, trame_number=2)’

2021-09-23 21:56:43,215 - INFO - HTTP call (POST) to the SI client: https://sigfox.middleware.tago.io/uplink with data: device=CE8E7C&[{

“variable”: “device”,

“value”: “CE8E7C”,

“serie”: “1632427002.0”

},{

“variable”: “data”,

“value”: “d00005c20c020002000100f9”,

“serie”: “1632427002.0”

},{

“variable”: “seqNumber”,

“value”: “1614”,

“serie”: “1632427002.0”

}] and headers: {‘Content-type’: ‘application/json’, ‘authorization’: ‘xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx’}

2021-09-23 21:56:43,594 - INFO - Client response: {“status”:false,“error”:“missing param device”}

2021-09-23 21:56:43,594 - INFO - SI Client response’<ClientResponse(https://sigfox.middleware.tago.io/uplink) [400 Bad Request]>

<CIMultiDictProxy(‘Content-Type’: ‘application/json’, ‘Content-Length’: ‘47’, ‘Connection’: ‘keep-alive’, ‘Date’: ‘Thu, 23 Sep 2021 19:56:43 GMT’, ‘X-Amzn-Requestid’: ‘d03a622d-42b0-411c-bdd2-357d4db506bf’, ‘Access-Control-Allow-Origin’: ‘*’, ‘X-Amz-Apigw-Id’: ‘GIdPQFX7oAMFhgA=’, ‘X-Amzn-Trace-Id’: ‘Root=1-614cdbfb-09ab46db13ce517130bf1340;Sampled=0’, ‘X-Cache’: ‘Error from cloudfront’, ‘Via’: ‘1.1 a5b64a1ac22cdce92ad57684d05480be.cloudfront.net (CloudFront)’, ‘X-Amz-Cf-Pop’: ‘CDG52-P1’, ‘X-Amz-Cf-Id’: ‘-fI8Q-rSPhVolDQEk3mTs8_5ZXrd8p4IwLAJMSdWBmzK64UfRGcfFA==’)>’

Patrice

hi @plegarff,

You aren’t sending the device in parameters. The device={device} is being sent in the body (data).

Idon’t know how this Sigfox emulator is configured. But, you need to configure the device something like: https://sigfox.middleware.tago.io/uplink&device={device}

Hi,
This is what I’ve done.


But in documentation, it said :
“Note that if you put some variables in the query part of the URL, these parameters will be
appended to the body, whether it is empty or not.”

Can you customize the body of the request?
Like in the sigfox backend:

If you can’t customize your body like our documentation shows, your data won’t be accepted, because the middleware doesn’t expect it.

We added support to past in the parameter the “device”, if you are using other fields will not work.

Just to remind you that the middleware and TagoIO integration are based on the Sigfox backend documentation.

Hi @plegarff,

As your Sigfox Emulador sends an HTTP request with data from sigfox, so you may use our “Generic Middleware”, it can work for you, follow this topic: How to Integrate TagoIO with a Generic HTTPS Endpoint

Reminder: the Generic Middleware, you must use the connector (not the Sigfox).