NodeRed - Http Requests - Error 415

Hi everybody,

I need some help with node-red and the “http request” component.
I try to use some API but I get only http error 415 whereas I set up the headers.

I follow this steps on NodeRed doc : Set a request header : Node-RED but it’s not working I don’t uderstand why I get this message …

Is there somebody who can help me with a tutorial or a track to follow ?

You might also need to send a header of Accept: application/json.

HTTP headers are supposed to be case insensitive, but given it’s normally expressed as ‘Content-Type’, so that also might be worth trying.

I’m using this in a function, and it works fine:

msg.headers['Authorization'] = 'myauthorization 1234567890abcde fghijklm';
msg.headers['User-Agent'] = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/103.0.0.0 Safari/537.36';
msg.headers['Accept'] = '*/*';
msg.headers['Accept-Encoding'] = 'gzip, deflate, br';
msg.headers['Cache-Control'] = 'no-cache';
msg.headers['Content-Type'] = 'application/json';

Thanks for your code I add a function to set this and it’s seems to change something because now I get an 500 error while I used to have 415 error :slight_smile:

So I have to find why this now.

Thank you !

This is a generic authorization, you are supposed to use you own credentials here :wink: