• Register
    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search

    http post

    Node-RED
    1
    3
    914
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • J
      juntiedt last edited by

      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.

      1 Reply Last reply Reply Quote 0
      • J
        juntiedt last edited by

        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;
        
        1 Reply Last reply Reply Quote 0
        • J
          juntiedt last edited by

          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;
          
          1 Reply Last reply Reply Quote 0
          • First post
            Last post