2 Replies Latest reply on Oct 28, 2015 11:34 AM by ecorban

    Open NX API Sandbox access

    chris.lambert@radianz.com

      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?

        • 1. Re: Open NX API Sandbox access
          ecorban

          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

          • 2. Re: Open NX API Sandbox access
            ecorban

            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.