0
votes

I have been trying for most of the weekend to try and figure out how to retrieve data using Node-Red on a Raspberry Pi from the ‘Data Storage’ on The Things Network.

If I use Swagger, I can retrieve data, and as a first step, I am trying to replicate this functionality within Node-Red, but I can’t seem to get it working.

So far I have setup a simple flow:-

Inject => HTTP Get Request => Debug output.

I have tried setting various ways in the inject node, but no matter what I try and do I get ‘Not Authorised’. I’ve got the credentials “Content-Type":"application/json” "Authorization":"key ttn-account-v2.hKfO9VxxxxxxxxxxxxxxxxxxxxxfwZFU6G4A080s”

I’ve put these in the msg.header, the msg.payload, and others, without any really success.

I would really appreciate any ideas on how to get it to work.

Edit: As requested, here is info as to how I am setting the data. The inject node has properties that are setting the msg.

inject node properties.

I have tried a few different combinations, but no success.

1
Any reason why you are not using the TTN nodes? flows.nodered.org/node/node-red-contrib-ttn - hardillb
Also edit the question to show how you are setting the headers. - hardillb
Hi Hardillb, thanks for the quick response. I’m not using the node-red-contrib-ttn as the GitHub respository is deprecated and no longer updated. - Matthew Bennett
Please edit the question to include the full JSON from both the msg.payload and the msg.headers (you can xxx out the password/key) But both Authorization and content-type want to be in the headers. - hardillb
We also need to know what the errors are you get back - hardillb

1 Answers

0
votes

msg.headers should contain both the Content-Type and the Authorization values

e.g.

{
  "Authorization": "key ttn-account-v2.hKfO9VxxxxxxxxxxxxxxxxxxxxxfwZFU6G4A080s",
  "Content-Type": "application/json"
}