JSON parse error but URL working in browser

Hi everyone,
I'm new in Node Red and hope my message was not covered in previous posts. Thank you in advance for your help.

When I try to access this URL via the browser I got a JSON in the right format: https://api.solcast.com.au/rooftop_sites/514f-7ef7-a860-8acb/forecasts?format=json

When I copy it in an HTTP request node, I got the following error message:

02/05/2024 22:20:03[noeud: API]
msg : string[16]
"JSON parse error"

What am I doing wrong?
Best, Tom

Welcome to the forum.

Change the http node to return a string and see what you are getting back.

1 Like

If I hit that URL with curl I get a 401 error

I assume you are including some credential when using Node-RED?

Moved this to general category, as not about node development.

I also get a 401 in a browser.

1 Like

Thanks @Colin ! You mean, change the output to UTF8 or change the node?

No this is a public one, strangeā€¦

It may be public but according to the API's documentation they must have issued you an API key when you register in order to authenticate and make requests.

They have some Postman Examples for the API here

So in your http-request node set it to

image

and in the Token field try to add your API key.

1 Like

Yes that was it, working fine now many thanks!

1 Like