Product Documentation

FairCom REST API for Node-RED

Previous Topic

Next Topic

Installing the Node-RED REST API

Note: Some FairCom releases ship without the plug-ins installed. To make the three REST tutorials work in those products, you must un-zip winX64\bin\ace\sql\plugins.exe, uncomment PLUGIN cthttpd... in the ctsrvr.cfg file, and then restart the c-tree server.

To install the Node-RED REST API, follow these steps:

  1. First, make sure Node-RED is installed on your system. For example, on Linux you could use:

    sudo npm install -g --unsafe-perm node-red

    Windows users can try typing node-red from a command shell.

  2. Verify your Node-RED installation is v12 or after. “node --version” will show you what you have installed. If necessary go to nodejs.org and download v12 and install it. We are not compatible with v8, v10 should work, v12 is preferred.
  3. If Node-RED is running, shut it down to install the FairCom node. Then go into the Node-RED home directory with a command prompt. For example, use the following:

    On Windows, this is usually the following folder: C:\Users\my_name\.node-red

    On Linux, this is usually the following folder: ~\.node-red

    If this folder is missing, you might have to start and stop Node-RED once.

  4. Issue the following command to install the FairCom c-tree node:

    npm --prefix . install <path to node-red-contrib-ctree folder>

    In the example above, the path to the node-red-contrib-ctree folder is typically drivers\node-red.rest.crud\node-red-contrib-ctree, starting from your FairCom product install folder. The first time you run this command, it will download packages, so be sure your computer is connected to the Internet.

    Do not install the node-red-contrib-ctree-ctrl node.

    On Windows, this will make a node-red-contrib-ctree item appear in your C:\Users\my_name\.node-red\node_modules folder.

  5. Make sure your FairCom product is running (see Starting the FairCom Database Engine), and then start Node-RED again and open it in your favorite browser.

    The URL usually should be similar to: http://localhost:1880

You should now see a new node, called "ctree", under the "storage" section. For information on using the node, see the sections below.

If the "ctree" node is not present, exit Node-RED, delete the "node-red-contrib-ctree" item your C:\Users\my_name\.node-red\node_modules folder (Windows), or from your ~\.node-red\node_modules folder (Linux). Then return to step 4 (above) and re-issue the "install" command.

For more information, see the Node-RED chapter in the FairCom Edge Developers Guide and the REST API Developer's Guide.

Note: If you are using a self-signed certificate, Node-RED may reject the connection because it is considered unauthorized and Node-RED will show a SELF_SIGNED_CERT_IN_CHAIN error on the console. To work around this, set the NODE_TLS_REJECT_UNAUTHORIZED environment variable to 0, and restart Node-RED.

Example for Unix:

$ export NODE_TLS_REJECT_UNAUTHORIZED=0

$ node red.js -v push2omnibus.json

TOCIndex