You want to post JSON data in to a flow.
Use the HTTP In
node to listen for POST requests that
have their Content-Type
set to application/json
and access the parsed JSON as
properties of msg.payload
.
[~]$ curl -X POST -d '{"name":"Nick"}' -H "Content-type: application/json" http://localhost:1880/hello-form
<html>
<head></head>
<body>
<h1>Hello Nick!</h1>
</body>
</html>
When the HTTP In
node receives a request with the Content-Type
header set to application/json
it parses the body of the request and makes the data
available under msg.payload
:
var name = msg.payload.name;
Node-RED: Low-code programming for event-driven applications.
Copyright OpenJS Foundation and Node-RED contributors. All rights reserved. The OpenJS Foundation has registered trademarks and uses trademarks. For a list of trademarks of the OpenJS Foundation, please see our Trademark Policy and Trademark List. Trademarks and logos not indicated on the list of OpenJS Foundation trademarks are trademarks™ or registered® trademarks of their respective holders. Use of them does not imply any affiliation with or endorsement by them.
The OpenJS Foundation | Terms of Use | Privacy Policy | OpenJS Foundation Bylaws | Trademark Policy | Trademark List | Cookie Policy