http request parameters

I'm trying to set the right parameters for http request, but I'm not able to do it.
The query with curl is this:
curl -H "Content-Type: application/json" -X GET -d '{"auth_key":"xf79rra", "payload":null}' https://retepaiot.it/sensordata/0018b1213
and it works.
I think I made somethings wrong passing auth_key and payload (they are not via URL).
I use the function to prepare the message:
msg.headers = {

  • "Content-Type": "application/json"*
  • } *
    msg.payload = {};
    *msg.payload = {auth_key:"xf79rra", *
  • payload:null};*
    return msg;

and http request for URL:
https://retepaiot.it/sensordata/0018b1213

the returned message is:
{ "message": "Failed to decode JSON object: Expecting value: line 1 column 1 (char 0)"}

Can I have some help?
Thanks,
Fabrizio

Can you post the function code using the preformatted text block:

msg.headers = { "your": "code" };

The problem is that the method GET, called from http request, doesn't manage the payload (body on http). Simply it ignores it (this is conforms to the protocol).
The REST server isn't fully compliant with the GET method.
For now, the unique solution I've found was to modify the node http request. Best if I rewrite it into a new node.

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