I'm not too sure where the problem lies with this one, but it seems to arise in Node-Red only so I'm asking here first.
Solcast API call should return JSON, but I seem to only get back html in NR.
My call is:
https://api.solcast.com.au/rooftop_sites/xxxx-xxxx-xxxx-xxxx/forecasts?format=json&hours=48&api_key={API KEY}
where xxxx is my site ID and {API KEY} is my personal key.
[
{
"id": "8173ff729284cc7e",
"type": "http request",
"z": "acf06df9c6b509cc",
"name": "Solcast forecast",
"method": "GET",
"ret": "obj",
"paytoqs": "ignore",
"url": "https://api.solcast.com.au/rooftop_sites/xxxx-xxxx-xxxx-xxxx/forecasts?format=json&hours=48&api_key={API KEY}",
"tls": "",
"persist": false,
"proxy": "",
"authType": "",
"senderr": false,
"credentials": {},
"x": 300,
"y": 80,
"wires": [
[
"55bbf03a32309649",
"d0a58f1004ca461b",
"76cb289f11212323"
]
],
"info": ""
}
]
I've also tried setting the return string to UTF-8.
The response I get is:
<!doctype html>
<html lang="en-us">
<head>
<title>GetRooftopSiteForecast Snapshot of 02/23/2022 01:27:06</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<style type="text/css">
BODY, H1, H2, H3, H4, H5, H6, DL, DT, DD {
margin: 0;
padding: 0;
color: #444;
font: 13px/15px Arial, Verdana, Helvetica;
}
If I pass the msg to a JSON node I get an error that the first character is <, which fits with it receiving html.
If I put the same request into my browser I get:
{"forecasts":[{"pv_estimate":4.6525,"pv_estimate10":3.9215,"pv_estimate90":5,"period_end":"2022-02-23T01:30:00.0000000Z","period":"PT30M"},{"pv_estimate":4.983,"pv_estimate10":4.1996,"pv_estimate90":5,"period_end":"2022-02-23T02:00:00.0000000Z","period":"PT30M"},{"pv_estimate":4.9969,"pv_estimate10":4.2031,"pv_estimate90":5,"period_end":"2022-02-23T02:30:00.0000000Z","period":"PT30M"},
Similarly if I use curl I get the expected json returned.
I've looked at a couple of other user's calls to solcast and they seem to be structured the same (I've imported their flows, copied the http node and edited it to my site and api key and get the same result).
So can anyone shed light on why NR is receiving html instead of json?
Thanks