Help us improve your experience.

Let us know what you think.

Do you have time for a two-minute survey?

 
 

Example: Configuring the REST API

This example demonstrates how to configure the REST API on a Junos OS device.

Requirements

  • A routing, switching, or security device running Junos OS Release 14.2 or later is required.

Overview

This example configures the REST API on a Juniper Networks M10i Multiservice Edge Router. The example configures both HTTP and HTTPS access, with both lighttpd and juise tracing.

Configuration

CLI Quick Configuration

To quickly configure this example, copy the following commands, paste them in a text file, remove any line breaks, change any details necessary to match your network configuration, copy and paste the commands into the CLI at the [edit] hierarchy level, and then enter commit from configuration mode.

Configuring the REST API

Step-by-Step Procedure

To configure the REST API:

  1. Specify allowed IP addresses for incoming HTTP and HTTPS connections.

  2. Specify the maximum number of allowed connections over both HTTP and HTTPS.

  3. Set the TCP port for incoming HTTP connections.

  4. Set the addresses on which the server listens for incoming HTTP connections.

  5. Set the TCP port for incoming HTTPS connections.

  6. Set the addresses on which the server listens for incoming HTTPS connections.

  7. Set the server certificate.

  8. Configure the set of ciphers the server can use to perform encryption and decryption functions.

  9. (Optional) Set up TLS mutual authentication on both the server and client with a certificate.

  10. (Optional) Configure trace options for lighttpd, juise, or both.

  11. (Optional) Enable the REST API Explorer.

  12. Commit the configuration.

Results

Verification

Verifying REST API Configuration

Purpose

Confirm that the REST API configuration is working properly on the device.

Action

Display the REST API configuration by issuing the show configuration system services rest operational mode command.

Meaning

This example configured both HTTP and HTTPS access on a Juniper Networks M10i Multiservice Edge Router. For HTTP access, the device listens on port 3000 and permits traffic from IP addresses 192.0.2.0, 198.51.100.0, 203.0.113.0, and 203.0.113.1. For a more secure connection, HTTPS access was configured with mutual authentication, using port 3443 and allowed IP addresses of 192.0.2.0, 198.51.100.0, 203.0.113.2, and 203.0.113.3. A connection limit of 100 has been configured for both HTTP and HTTPS, and both juise and lighttpd tracing has been enabled. By default, the REST API Explorer is disabled (see Example: Using the REST API Explorer).