Home > Use Postman to configure CSR1000v router on Cisco Sandbox with RESTCONF

Use Postman to configure CSR1000v router on Cisco Sandbox with RESTCONF

Postman and RESTCONF are two topics that we need to grasp in the ENCOR exam so in this tutorial we will learn the basis about them. In order to complete this tutorial, please download and install Postman first. This is a simple task so we will not mention it here.

After installing Postman, go to this Postman link and export the Cisco IOS-XE collection to a file on your local drive because we are going to communicate to a Cisco IOS XE router via Postman.

Postman_collection_export.jpg

Choose the latest version of Collection is better so we will choose “Collection v2.1”.

Postman_collection_export2.jpg

Now open Postman to import the collection by clicking on “Import” button:

Postman_import_collection.jpg

Choose the downloaded file to upload:

Postman_import_collection_upload_file.jpg

And now we have a list of RESTCONF APIs (commands) under “Cisco IOS-XE” collection to play with.

Postman_import_collection_success.jpg

But where will we send these commands to? It is nice that Cisco offers many free devices online to practice with in the DEVNET program. You can visit this link: https://devnetsandbox.cisco.com/RM/Topology and search for “IOS XE”. The website returns a list of labs but we should choose “IOS XE on CSR Latest …” (Always On) lab as we don’t have to wait to reserve and use it like other labs.

sandbox_devnet_search_IOS_XE.jpg

After accessing this lab, all the information we need is in the red box below. It tells us where to send our RESTful APIs in Postman to along with the username and password.

sandbox_devnet.jpg

Now return to our Postman, we will provide the username and password provided above to the “Basic Authentication”.

Postman_Basic_Authentication.jpg

In the “Type” drop-down box of “Auth” tab, choose “Basic Auth” and enter the username “developer” and password “C1sco12345” as provided in the Cisco sandbox website above.

Postman_Basic_Authentication_2.jpg

Set “Inherit auth from parent” for sub-category “RESTCONF” so that it will use the authentication information from parent node “Cisco IOS-XE”.

Postman_Inherit_Auth.jpg

In each RESTful API we are going to send, we also have to choose “Inherit auth from parent” too.

Postman_set_basic_Auth.jpg

Define variables

After setting the authentication, now we can have a closer look on the RESTCONF commands. When hovering mouse on {{host}} in the URL, we can see an “Unresolved Variable” popup. It means Postman has not learned how to interpret this {{host}} variable yet.

Postman_unresolved_variable.jpg

In order to define this variable, click on the eye icon at the top-right corner of Postman and choose either “Add” Environment or Globals.

Postman_add_Environment.jpg

Type “host” in the VARIABLE field to define this variable. In the INITIAL VALUE, copy the value “sandbox-iosxe-recomm-1.cisco.com” from the Cisco DEVNET website and paste here.

Same for “port” variable. Name this environment “Cisco IOS XE”. Then don’t forget to click on “Save” button.

Postman_set_global_environment.jpg

After saving we will have a new environment with name “Cisco IOS XE”, select it.

set_new_environment.jpg

Now we see our {{host}} variable has been resolved by the green icon “E” when hovering on it:

set_new_environment2.jpg

Remember to change Auth Type from “Basic Authentication” to “Inherit auth from parent” for each request we are going to send, then click on “Save” to save all the settings for this request. Unfortunately, we have to save each command for the first time.

save_request.jpg

Click “Send” and wait for a few seconds then we will receive the reply, notice the returned code is “200 OK”. The command we sent is a “GET” command, which is equivalent to a “show” CLI command. In this case we sent a “GET” interface state on this router.

request_sent_success.jpg

After getting information of interfaces successfully, we can try some configuration on the remote device.

Note: If you receive the error “Could not get response” SSL Error: Unable to verify the first certificate” then please click on “Disable SSL Verification” or you can disable it in Settings > SSL certificate verification

SSL_Error.jpg

Create a Loopback interface

Choose “Add new loopback interface” in the command list. Check the URL carefully because some are configured in http by default so if we submit them they will fail. Please change them to https instead:

Post_http.jpg

Configure new Loopback interface information in the “Body” part with the following information:

+ name: Loopback101
+ ip: 143.1.1.1
+ netmask: 255.255.255.0

Keep other information unchanged, then click “Send”. We will see a “201 Created” reply.

Postman_add_Loopback.jpg

Delete a Loopback interface

Next we will delete the Loopback 101 we have just created. We just need to type “Loopback101” at the end of the command. If everything is correct, we will be replied with status “204 No Content”

Postman_delete_loopback101.jpg

Note: HTTP status code of 2xx means “Success”, which indicates that the client’s request was accepted successfully.

You can find some other labs in this Cisco Live PDF (backup link here). It is a good resource to learn about Postman and RESTCONF.

Comments
  1. apex
    November 16th, 2021

    Superb content

  2. JANG
    November 30th, 2021

    Good Example for RESTCONF STUDY.

  3. Renny
    May 17th, 2022

    Excellent example

  4. Anonymous
    July 2nd, 2022

    Anyone, is there a PDF version of the info? I want to create a VCE which helps me learn faster.

  5. Soon
    August 14th, 2022

    Can you share vce player please

  6. CAB
    September 24th, 2022

    Supper cool excercise!

  7. CAB
    September 24th, 2022

    If you get no 200 OK then go to the Settings tab and Turn OFF “Enable SSL certificate verification”

  8. CAB
    September 24th, 2022

    Turn off “Enable SSL certificate verification” if receive no 200ok

  9. CAB
    September 24th, 2022

    off > Enable SSL certificate verification

  10. ton
    October 1st, 2022

    last dump?

  11. Andy
    January 5th, 2023

    Nice , very nice work guys. Thank you !

  12. Jam
    May 23rd, 2023

    Hi,
    I follow the steps here but still, 502 Bad Gateway
    Already off “Enable SSL certificate verification”

    502 Bad Gateway

    502 Bad Gateway

    nginx/1.13.12

  13. Jam
    May 28th, 2023

    use “lastorangerestoreball8876” as password, credentials shared here was not updated.

  14. trs from brazil
    October 4th, 2023

    “unauthrized” someone could help me

  15. ZBeuuh
    February 11th, 2024

    Thank You

  1. No trackbacks yet.