The documentation set for this product strives to use bias-free language. For the purposes of this documentation set, bias-free is defined as language that does not imply discrimination based on age, disability, gender, racial identity, ethnic identity, sexual orientation, socioeconomic status, and intersectionality. Exceptions may be present in the documentation due to language that is hardcoded in the user interfaces of the product software, language used based on RFP documentation, or language that is used by a referenced third-party product. Learn more about how Cisco is using Inclusive Language.
This chapter contains the following sections:
The REST API supports retrieving system information from the Cisco Nexus 1000V.
You can read an object on the Cisco Nexus 1000V Virtual Supervisor Module (VSM) using the Representational State Transfer (REST) web services API. In order to call any REST function, you can use tools such as a web browser, the cURL tool, and Windows PowerShell.
The following is the basic construct of a REST URL:
http[s]://<IP_address>/api/<resource locator>
The resource locator consists of two parts:
<resource locator> := <name space>/<resource name>
<name space> indicates the broader class of functions and <resource name> refers to the specific object.
For example, in the following URL:
http://10.10.10.2/api/n1k/license
n1k is the namespace and license is the resource name.
If you are using a browser, type in the URL. For example, if you want to get the license information of your VSM that has an IP address of 10.10.10.2, you type the URL as follows:
https://10.10.10.2/api/n1k/license
The browser prompts you for a username and a password and returns the HTML output.
To access the same through cURL, you use the following format:
curl http://username:password@10.10.10.2/api/n1k/license
You get the following XML output:
<set name="license_set"> <instance name="NEXUS_VSG_SERVICES_PKG" url="/api/n1k/license"> <properties> <expires>04 May 2013</expires> <type>NEXUS_VSG_SERVICES_PKG</type> <available>512</available> <status>Unused</status> <used>0</used> </properties> </instance> <instance name="NEXUS_ASA1000V_SERVICES_PKG" url="/api/n1k/license"> <properties> <expires>04 May 2013</expires> <type>NEXUS_ASA1000V_SERVICES_PKG</type> <available>16</available> <status>Unused</status> <used>0</used> </properties> </instance> <instance name="NEXUS1000V_LAN_SERVICES_PKG" url="/api/n1k/license"> <properties> <expires>04 May 2013</expires> <type>NEXUS1000V_LAN_SERVICES_PKG</type> <available>1024</available> <status>Unused</status> <used>0</used> </properties> </instance> </set>
Every REST API function is associated with a resource name
To find the list of Cisco Nexus 1000V resource names, construct the URL as follows:
https://10.10.10.2/api/n1k
You get the following output:
<set name="api_set"> <instance url="/api/n1k"> <children> <child name="uplink" url="/api/n1k/uplink"/> <child name="vnic" url="/api/n1k/vnic"/> <child name="port-profile" url="/api/n1k/port-profile"/> <child name="summary" url="/api/n1k/summary"/> <child name="license" url="/api/n1k/license"/> </children> </instance> </set>
Namespace |
Description |
---|---|
/api/n1k |
Lists the available elements that can be queried through the interface. |
/api/n1k/uplink |
Lists the details of the uplink interfaces configured on the VSM. |
/api/n1k/vnic |
Lists the details of the virtual Ethernet ports connected to the Nexus 1000V switch. |
/api/n1k/port-profile |
Lists the details of the port profiles configured on the VSM. |
/api/n1k/summary |
Lists a summary of the Cisco Nexus 1000V switch. |
/api/n1k/license |
Lists the licensing status of the Cisco Nexus 1000V switch. |