Get HTTP request for JSON data from BOM

Hi, I've recent started using Node Red (V1.3.2) for building flows to access my weather station and I would like to compare its local weather data with that from Australian Bureau of Meteorology (BOM) web site that provides JSON data for my location.

When I enter the URL in Chrome it brings back a web page containing the current up-to-date JSON data for Melb - see http://www.bom.gov.au/fwo/IDV60901/IDV60901.95936.json
But when I plug that URL in node-red : http request as follows:

image

[{"id":"8d4b4d6.65e66b","type":"http request","z":"9f35912a.5daa8","name":"Get BOM Weather","method":"GET","ret":"obj","paytoqs":"ignore","url":"http://www.bom.gov.au/fwo/IDV60901/IDV60901.95936.json","tls":"b2c5d1ee.b7aec","persist":false,"proxy":"","authType":"","x":570,"y":900,"wires":[["636a21d.ab98ee"]]},{"id":"b2c5d1ee.b7aec","type":"tls-config","name":"local-tls","cert":"","key":"","ca":"","certname":"","keyname":"","caname":"","verifyservercert":false}]

I get the following error from BOM (via the debug node):

<HTML><HEAD>
<TITLE>Access Denied</TITLE>
</HEAD><BODY>
<H1>Access Denied</H1>
 
You don't have permission to access "http&#58;&#47;&#47;www&#46;bom&#46;gov&#46;au&#47;fwo&#47;IDV60901&#47;IDV60901&#46;95936&#46;json" on this server.<P>
Reference&#32;&#35;18&#46;67a37468&#46;1618397169&#46;11c69da
</BODY>
</HTML>

I might be incorretly assuming that the URL working on chrome could be used in the Node-Red http request URL espcially since it's http and not https. I haven't set up any headers or auth details.
What can I do to get the JSON data via the Node-Red http request?

Thanks and regards
Joe.

Try spoofing the firefox or another browsers user-agent headers.
eg.

[{"id":"4f15f387.24ecc4","type":"inject","z":"5a245aa1.510164","name":"","props":[{"p":"payload"},{"p":"headers.User-Agent","v":"Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:47.0) Gecko/20100101 Firefox/68","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":100,"y":3620,"wires":[["665ce955.7e8628"]]},{"id":"665ce955.7e8628","type":"http request","z":"5a245aa1.510164","name":"","method":"GET","ret":"obj","paytoqs":"ignore","url":"http://www.bom.gov.au/fwo/IDV60901/IDV60901.95936.json","tls":"","persist":false,"proxy":"","authType":"","x":310,"y":3620,"wires":[["759a8f1c.44e9b"]]},{"id":"759a8f1c.44e9b","type":"debug","z":"5a245aa1.510164","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":560,"y":3620,"wires":[]}]

Thanks. That worked!! Great.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.