Cisco DCNM REST 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.