Cisco DCNM REST APIs

Getting Started

Cisco DCNM provides REST APIs that allow third parties to test and develop application software. The REST API documentation is packaged with Cisco DCNM, and you can access it through any browser.

Accessing the DCNM REST API documentation involves the following steps:

Procedure


Step 1

Log in to your Cisco DCNM Web Client.

Step 2

Go to the URL: https://DCNM-IP/api-docs.

Step 3

Choose the definition from the Select a definition drop-down list.

The valid options are:

  • DCNM

  • elasticservice

  • Endpoint Locator

The default option is DCNM.

Note 
The Endpoint Locator option and the elasticservice option appear only in the LAN Fabric deployments.

The following figure shows an example DCNM REST API documentation.

Figure 1. Example Cisco DCNM REST API Documentation

What to do next

Expand the APIs from the API categories and use them according to the task you want to perform.

Viewing REST APIs in DCNM

Launch https://DCNM-IP/api-docs.

API Categories

LAN Fabric

Media Controller

SAN Management

Alarms

Yes

Yes

Yes

Cloud Extension

Yes

Config Deployer

Yes

Control - DCNM Tracker

Yes

Control - Fabrics

Yes

Control - Interface Service

Yes

Control - Inventory

Yes

Control - Links

Yes

Control - Policies

Yes

Control - Switches

Yes

Customization

Yes

Yes

Yes

DCNM Config Backup and Restore

Yes

DCNM Connect

Yes

DCNM Discovery

Yes

DCNM EPLD Image Management

Yes

DCNM Image Policy Management

Yes

DCNM Inventory

Yes

Yes

Yes

DCNM Package Management

Yes

Yes

DCNM Performance

Yes

DCNM PMN Discovered Hosts

Yes

DCNM PMN Events Management

Yes

DCNM PMN Flow Alias Management

Yes

DCNM PMN Flow Policy Management

Yes

DCNM PMN Flow Status

Yes

DCNM PMN Global Settings

Yes

DCNM PMN Host Alias Management

Yes

DCNM PMN Host Policy Management

Yes

DCNM PMN Multicast NAT Border Routers

Yes

DCNM PMN Multicast NAT Egress Interface Mappings

Yes

DCNM PMN Multicast NAT Modes

Yes

DCNM PMN Multicast NAT Rules

Yes

DCNM PMN RTP Service

Yes

DCNM PMN Static Receiver Management

Yes

DCNM PMN Topology Management

Yes

DCNM PTP Management

Yes

Yes

DCNM Session management

Yes

Yes

Yes

DCNM Storage

Yes

DCNM Templates

Yes

Yes

Yes

Image Management

Yes

Yes

Yes

Local Zones

Yes

Progress Tracker

Yes

Resource Manager operations

Yes

Service Network Operations

Yes

Telemetry

Yes

Yes

Yes

Top Down LAN Network Operations

Yes

Top Down LAN Network Operations v2

Yes

Top Down LAN VRF Operations

Yes

Top Down LAN VRF Operations V2

Yes

Click Show/Hide corresponding to the API category. Alternatively, click on any category link to expand or collapse it. When you expand the category, you can see the corresponding APIs under it. The following figure shows the APIs in the DCNM Inventory category.

Figure 2. APIs in the DCNM Inventory Category

There are four types of API methods:

  • GET: Fetch existing information or data from the DCNM server.

  • POST: Create new information or data.

  • DELETE: Delete existing information or data.

  • PUT: Update existing information or data.

Using GET APIs

To use a GET API in Cisco DCNM Web UI, perform the following steps:

Procedure


Step 1

Click the GET API you want to try out.

The API section expands and you can view the details of the API.

Step 2

Click Try it out.

Step 3

Enter the values under the Parameters area.

Step 4

Click Execute.

You can view the response body and response headers under the Responses area.

Step 5

(Optional) Click Download to download the response body.

Step 6

(Optional) Click Clear to clear the responses.

Note 

The images are used to illustrate an example. The procedure remains the same for all GET APIs.


REST API Tool

Operations like discovery, fabric management, monitoring, and so on, which are performed in Cisco DCNM Web UI, invoke HTTP calls to fetch and commit the information accessed. The REST API tool enables you to examine the API call by viewing the structure of an API call. This tool also provides a corresponding CURL request to help with building quick prototypes and testing APIs.

The REST API Tool dialog box has the following fields.

Table 1. Fields and Description for the REST API Tool Dialog Box

Field

Description

Filter

Enter any keyword to search the log.

scroll to new items

Check this check box to scroll to the new entries when you navigate back to the REST API Tool dialog box after you perform an operation in the Web UI.

This check box is checked by default.

clear log

Click clear log to clear the log in the dialog box.

API-docs

Click API-docs to view the Cisco DCNM REST API documentation in the Web UI. Clicking this option takes you to the following URL: https://DCNM-IP/api-docs

All actions you perform in the Cisco DCNM Web UI appear in the API inspector tool. The following information appears in the APIs invoked for every operation:

  • HTTP method

  • URI

  • Payload

  • HTTP status code

  • Time taken for the operation

Click the URI to expand or collapse each REST method. You can perform the following actions after expanding a REST method:

  • Prettify output: Click this option to arrange the response code in a more presentable way, which otherwise appears in a single line. Scroll through the response to view it completely.

  • Copy response: Click this option to copy the response code to your clipboard.

  • Copy CURL request: Click this option to copy the CURL request to your clipboard.

    curl -k -XGET --header 'Dcnm-Token: <DCNM_TOKEN>' --header 'Content-Type: application/x-www-form-urlencoded' https://<ip-address>/fm/fmrest/dcnm/rbacNavigation/?uname=admin 

The REST API Tool dialog box updates every time the Cisco DCNM Web UI updates.

To use the API inspector from the Cisco DCNM Web UI, perform the following steps:

Procedure


Step 1

Click the Gear icon in the top pane.

Step 2

Choose REST API Tool from the drop-down list.

The REST API Tool dialog box appears and the log is empty before you perform any operation in the Cisco DCNM Web UI.
Step 3

Minimize the REST API Tool dialog box.

Note 

You can also keep the dialog box open, but not close it.

Step 4

Perform an operation in the Cisco DCNM Web UI.

Note 

You can perform any operation in the Cisco DCNM Web UI like viewing any options, adding, deleting, and so on.

Step 5

Navigate back to the REST API Tool dialog box.

The log is populated with the REST APIs fetched depending on the operations you performed.

Note 

Closing the REST API Tool dialog box, instead of minimizing it before performing any operations, clears the log.

For a demo on some of the operations that can be performed using the REST API tool, see the Using REST API Tool in Cisco DCNM video.