I am trying to do a simple http get request in Node-RED. According to online documentation I have to pass the parameters in a function as input for the http request node. My function looks like this;
msg.url = "https://api.socialstudio.radian6.com/v3/posts"
msg.method = "GET"
msg.headers = {'access_token': access_token}
msg.payload = {
'topics': 234243,
'limit': 100,
}
return msg;
However when i look at the server response i get the error:
["{"error":{"message":"Missing topics parameter.","statusCode":400,"errorCode":"MC-Unknown","requestId":"RnY9E0pbcU1lkiaf"},"meta":null}"][1]
I have tried other api's but I have not yet been able to pass the payload parameters.
What am I doing wrong?
If you want to pass query parameters for a GET request you should set the base URL in the http request node
and use the mustache syntax to include them:
https://api.socialstudio.radian6.com/v3/posts?topics={topics},limit={limts}
and change the function node to this:
msg.method = "GET"
msg.headers = {'access_token': access_token}
msg.topics = 234243;
msg.limit = 100;
return msg;