POST /nodes

Install a new node module

Requires permission: nodes.write

Headers

Header Value
Authorization Bearer [token] - if authentication is enabled
Content-type application/json - if installing from a npm repository
Content-type multipart/form-data - if installing a tgz package

Arguments

When installing a package from a npm repository the request body must be a JSON string with the following fields:

Field Description
module Either the name of the node module to install from the npm repository, or a full path to a directory containing the node module. Note: this api does not support the full range of module specifiers used by npm such as .tgz files or version qualifiers.
{
  "module": "node-red-node-suncalc"
}

If installing a tgz package the request body must be a multipart/form-data

The following curl example will install node-red-contrib-foo.

curl -X POST http://localhost:1880/nodes -H "Content-Type: multipart/form-data" -F "tarball=@node-red-contrib-foo-1.0.3.tgz;type=application/x-compressed-tar;filename=node-red-contrib-foo-1.0.3.tgz"

Response

Status Code Reason Response
200 Success A Node Module object. See example response body
400 Bad request An Error response
401 Not authorized none
404 Not found none
{
  "name": "node-red-node-suncalc",
  "version": "0.0.6",
  "nodes": [
    {
      "id": "node-red-node-suncalc/suncalc",
      "name": "suncalc",
      "types": [
        "sunrise"
      ],
      "enabled": true,
      "loaded": true,
      "module": "node-red-node-suncalc"
    }
  ]
}