http post



  • Hi, I am able to post a bulk request with this function node:

    msg.url = "http://10.0.0.52:8080/bulk";
    msg.headers =JSON.stringify({"content-type":"application/json"});
    msg.payload = JSON.stringify({"group_queries": [{"device_types": ["temp"]}]});
    return msg;
    

    in oder to get all 1-wire sensors.

    But I have problems to write the code for setting relay 5 to on (post) or to write the code for getting the status of relay 5 (get).
    Would very much appreciate your help in this case.



  • solved it!

    msg.url = "http://10.0.0.52:8080/json/relay/3";
    msg.headers =JSON.stringify({"content-type":"application/json"});
    msg.payload = JSON.stringify({"value": "1","timeout": "20"});
    return msg;
    


  • this works as well:

    msg.url = "http://10.0.0.52:8080/json/relay/3";
    msg.headers ='({"content-type":"application/json"})';
    msg.payload = '({"value": "1","timeout": "20"})';
    return msg;