cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1941
Views
5
Helpful
4
Replies

Open NX API Sandbox access

chris.lambert
Level 1
Level 1

Hi I am trying to do REST calls to N9K and am having difficulty.

Instructions say - 'After Software VPN connection: Telnet/SSH access to the tool server and virtual network element. If required, to enable nxapi, run 'feature nxapi' on the switch. Use POSTMAN to post objects to the virtual element.'


1/ I have SSH access to N9k and toolbox server from windows PC.

2/ I enable feature nxapi on N9k and confirm running

switch-n9kV2# sh nxapi

nxapi enabled

HTTP Listen on port 80

HTTPS Listen on port 443

3/ When I try and use postman or standard HTTP/HTTPS from home PC to N9K sandbox management IP address i keep getting connection refused.

When I try and test if port 80/443 is open via telnei to those ports from toolbox server I get  connection refused

cisco@toolserver:~$ telnet 10.10.10.51 80

Trying 10.10.10.51...

telnet: Unable to connect to remote host: Connection refused

cisco@toolserver:~$

Any tips?

4 Replies 4

ecorban
Cisco Employee
Cisco Employee

hi chris

thanks for the enquiry. we'll reach out to the engineering team for support on your request. we hopefully

should hear back soon. as an possible solution  you may have to enable the http and/or https port on the n9kv switch.

engineering should be able to provide input.

Thanks eddie

please follow the steps to run NXAPI using postman.

On switch:

  • Login to the switch.
  • Run ‘config t’
  • Enable nxapi using ‘feature nxapi’. Exit to switch prompt
  • Run ‘copy r s’

NXAPI code:

POST-URL : http://SWITCH-IP/api/aaaLogin.json

Content-Type: application/json

Cache-Control: no-cache

POST BODY :

{

  "aaaUser" : {

"attributes" : {

"name" : "SWITCH_USER",

"pwd" : "SWITCH_PASSWORD"

    }

  }

}

Postman:

  • Open postman
  • Copy POST URL, mentioned in above section, after replacing SWITCH-IP with IP address of Nexus switch .
  • Select method as POST
  • Open raw JSON section.
  • Copy POST-BODY JSON to raw JSON body section of postman.
  • Replace SWITCH_USERNAME with switch user.
  • Replace SWITCH_PASSWORD with switch password.
  • Click send button

This would save the cookie and after that, you can query other NXAPI using postman without login. And HTTP and HTTPS query from browser should work.

I'm trying to do the NX-OS sandbox lab from devnet site.I'm trying to make API calls using the postman but i get below error.Not sure what is wrong.I'm doing the same steps as in tutorial.Would be great if someone helps me out

 

 

Could not get any response
There was an error connecting to https://sbx-nxos-mgmt.cisco.com/api/aaaLogin.json.
Why this might have happened:
  • The server couldn't send a response:
    Ensure that the backend is working properly
  • Self-signed SSL certificates are being blocked:
    Fix this by turning off 'SSL certificate verification' in Settings > General
  • Proxy configured incorrectly
    Ensure that proxy is configured correctly in Settings > Proxy
  • Request timeout:
    Change request timeout in Settings > General

Hi,

 

We are using self-signed SSL cert for the sandbox. Please disable "SSL certificate verification" in your Postman to allow the request. The detailed postman settings could be found at https://learning.getpostman.com/docs/postman/launching_postman/settings/

 

Regards,

Bob