In this recipe, we'll make an example app, rest.js, using Node.js to connect to the Junos OS REST API in order to make procedure calls. We'll use Node.js's built-in HTTPS support, augmented with some extra external modules simply for convenience. For utility value, we'll provide some command-line options to customize how the application runs.
Command line option |
Description |
-t xml | json | text |
Specify the output format |
-r rpc |
Specify the actual RPC call |
-c certificate |
Self-signed certificate from router |
-p port |
HTTPS port number, default 8443 |
-u username |
Username to authenticate with |