HTTP Integration not working!


(Tejasa97) #1

I am conveniently receiving data on my application(Console), and I have set up an HTTP Integration to one of my webhosts. I've kept Auth blank, and put a optional custom header 'Content-Type':'application/json'. But i receive absolutely NO post requests. I've also configured my site to send me an SMS every time a POST request is made(yes, I tried with a post request using Postman and it does work). I also tried using a temporary http endpoint like Requestbin, but to no avail. Help? Is the HTTP Integration service currently down??


#2

Some network systems are experiencing issues , don't know if that's related to you


#3

@tejasa97 sending you a DM

No known issues with HTTP integration

Will follow up here


(Tejasa97) #4

HTTP Integration seems to be working now (still shaky, though, sometimes goes down without any warning), but it still takes close to 30-40 seconds to forward data (make the HTTP request)


(Trononimon) #5

Hello,
I did an HTTP integration to requestb.in. If I’m simulating an upload it works. If i get data from my device it does not work. Any suggestion what might be the difference? I see in the console for the simulated package there is no metadata. Might it be this?


(Trononimon) #6

is there a way to see the return code from calls from the HTTP integration?


(Arjan) #7

Return codes are set by your own server, right? (Things like 200 OK and 500 Internal Server Error?)

But maybe the MQTT events topic can show some details; https://www.thethingsnetwork.org/docs/applications/mqtt/api.html#error-events


(Trononimon) #8

Thanks that was a very good hint. I found out that I get an HTTP 400 Bad request
The json arrived at my server looks like this

052.169.225.045.60130-192.168.001.137.08080: POST /api/v1/ACxG-redacted-fL0/telemetry HTTP/1.1
Host: tron.internet-box.ch:89
User-Agent: http-ttn/2.6.0
Content-Length: 708
Content-Type: application/json
Accept-Encoding: gzip

{"app_id":"bubble_logger","dev_id":"heltec","hardware_serial":"0123456789AABBCC","port":1,"counter":291,"payload_raw":"Aqc=","payload_fields":{"bubbles":679},"metadata":{"time":"2018-11-13T20:25:35.810596656Z","frequency":868.5,"modulation":"LORA","data_rate":"SF11BW125","coding_rate":"4/5","gateways":[{"gtw_id":"eui-b827ebfffe97f686","timestamp":3645317348,"time":"2018-11-13T20:25:35.792731Z","channel":2,"rssi":-115,"snr":-13.5,"rf_chain":1,"latitude":47.379448,"longitude":8.548805,"altitude":504,"location_source":"registry"}]},"downlink_url":"https://integrations.thethingsnetwork.org/ttn-eu/api/v2/down/bubble_logger/thingsboard_local?key=ttn-account-v2.1UQ-redacted-P7o"}
192.168.001.137.08080-052.169.225.045.60130: HTTP/1.1 400 
X-Content-Type-Options: nosniff
X-XSS-Protection: 1; mode=block
Cache-Control: no-cache, no-store, max-age=0, must-revalidate
Pragma: no-cache
Expires: 0
Content-Length: 0
Date: Tue, 13 Nov 2018 20:25:36 GMT
Connection: close

I tried to with postman to modify the content of the POST and as soon as I have a nested json like the metadata and gateway than it fails. If I just send some key:value pairs it is working
like

192.168.001.102.53806-192.168.001.137.08080: POST /api/v1/ACx-redacted-fL0/telemetry?= HTTP/1.1
Content-Type: application/json
cache-control: no-cache
Postman-Token: 892ee8a4-9b13-442f-9899-e49ffbd282b4
User-Agent: PostmanRuntime/7.4.0
Accept: /
Host: 192.168.1.137:8080
accept-encoding: gzip, deflate
content-length: 347
Connection: keep-alive

{
“app_id”:“bubble_logger”,
“dev_id”:“heltec”,
“hardware_serial”:“0123456789AABBCC”,
“port”:1,
“counter”:278,
“payload_raw”:“AsQ=”,
“bubbles”:555,
“downlink_url”:“https://integrations.thethingsnetwork.org/ttn-eu/api/v2/down/bubble_logger/thingsboard_local?key=ttn-account-v2.1UQ-redacted-7o
}
192.168.001.137.08080-192.168.001.102.53806: HTTP/1.1 200
X-Content-Type-Options: nosniff
X-XSS-Protection: 1; mode=block
Cache-Control: no-cache, no-store, max-age=0, must-revalidate
Pragma: no-cache
Expires: 0
Content-Length: 0
Date: Tue, 13 Nov 2018 20:29:19 GMT

The receiving server is a Thingsboard.io application running on a raspberry pi. Any Idea why the nested json tags are causing troubles?
THX Sergio


(Arjan) #9

We’d need to see the code that’s parsing/interpreting the JSON to make any guess. Note that gateways in metadata is an array of one or more gateways. But any JSON parser should be able to handle that.

However, you also wrote:

I don’t think requestb.in is doing any parsing/interpretation, but instead it’s just showing the payload? If true, and if showing that payload already fails for true device uplinks, then something odd is going on…

Beware that you posted secrets above. I’ve now redacted those, but once everything is running you might want to change the secrets.


(Trononimon) #10

actually I see in the thingsboard documentation that the do not allow nested json only on specific case with ts and values, and I think it also worked with the in the console simulated upload because it does not have the nested gateway block. Any chance to be able to format the json with the payload funktions in ttn?

docu from Thingsboard

The simplest supported data formats are:

{"key1":"value1", "key2":"value2"}

or

[{"key1":"value1"}, {"key2":"value2"}]

Please note that in this case, the server-side timestamp will be assigned to uploaded data!

In case your device is able to get the client-side timestamp, you can use following format:

{"ts":1451649600512, "values":{"key1":"value1", "key2":"value2"}}

(Arjan) #11

Okay, so no problems in requestb.in then?

Indeed, not every third party website will understand the data that the HTTP Integration sends. Using payload functions only affects the value of payload_fields; the rest of the JSON will not change.

But it seems you’re those who’re using the Professional Edition are lucky; see (today’s last post at) Has someone linked TTN with Thingsboard?


(Trononimon) #12

funny :slight_smile: I just managed to get my payload with node-red to thingsboard without professional edition. Thank you