Introduction to REST API

This topic is to discuss the following lesson:

I am new to Python and starting my first lab. In my virtual lab I have a CSR1000v connected to Ubuntu device with Python 3 installed on it and they can talk to each others.
I have no problems with the router config but when it gets to the script I have no idea where and how to write the script and how to push it to the router. Can you clarify the Python part please?
Thank you


Hello Hany

In order to get a good grasp of Python it would be a good idea to find an online tutorial (there are literally hundreds out there) that can get you started scripting. A suggestion would be to go to which is a start from scratch introduction that can give you the basics you need for scripting. But you can do your own search and find the course that will be best for you.

Once complete, if you have specific questions about how to apply it to networking and your virtual lab, we’ll be able to more specifically help you out.

I hope this has been helpful!


Hi Rene,

I’m getting the output below, when trying to activate csr_mgmt.

*May 6 19:20:30.764: %VMAN-3-VIRT_INST_INTERFACE: F0: vman: Virtual Service[csr_mgmt]::Network interfaces::The number of network interfaces required do not match the number configured::Number defined: 1, number configured: 0 *May 6 19:20:31.746: %VIRT_SERVICE-5-ACTIVATION_STATE: Failed to activate virtual service csr_mgmt

And I don’t see the “ip shared host-interface” command available:


Any ideas?


Hello Luis

That’s interesting… It could be that the syntax is different for a particular feature depending on the IOS being used. In the lesson, Rene is using a CSR1000v router running IOS XE 16.6.1. What device are you using?


Hi Laz,

I’m running the version below on EVE-NG. I think it was the only image that was available for free on Cisco’s website.

Router#sh ver
Cisco IOS XE Software, Version 03.11.02.S - Standard Support Release
Cisco IOS Software, CSR1000V Software (X86_64_LINUX_IOSD-UNIVERSALK9-M), Version 15.4(1)S2, RELEASE SOFTWARE (fc3)


Hello Luis

It seems that for versions of IOS XE 3.11S and 3.12S, the method of implementation is different than that described in the lesson.

For versions IOS XE 3.13S and later, as well as IOS XE Denali 16.3 and later, the implementation can be performed using either the older method, or that described in Rene’s lesson.

Take a look at the following document that further explains the differences in implementation for the various versions.

I hope this has been helpful!


1 Like

morning Team,

Cisco csr 1000v downloaded from gns3 marketplace does not include virtual-service. Does it needs a special license?


Hello Jorge

The CSR 1000v that is available at GNS3 is version 16.09.05. According to the Cisco Feature Navigator, it supports the RESTconf programmable interface. If this is not the version you have, take a look at the feature navigator to see if your version supports the expected features.

However, in order to enable management by REST API, there are some preliminary configurations that you must apply, and these are described further in this document.

Take a look and let us know your results.

I hope this has been helpful!


thanks Laz!! I will take a look at the document.

1 Like

Hi Rene and staff,
i work with “csr1000v-universalk9.16.06.07.ova” in vmware workstation pro 15.5
I tried to set a virtual-service with a different name, not csr_mgmt (the name i used was csr_rest )

The install has not completed
But, when i use the name “csr_mgmt” the install work fine !
Could you clarify this issue ? can it be solved ?

Hello Dominique

The virtual-service command is used to load a specific virtual services container to be used by a particular virtual services package, which is installed using a particular .ova package file.

The container name, in this case csr_mgmt, must be the same one that has been defined during the installation of the original package. The syntax of such an installation command can be seen below:

virtual-service install name virtual-services-name package file

For example, the installation of the REST API support can look something like this:

virtual-service install name csr_mgmt package bootflash: iosxe-remote-mgmt.2017-08-15_17.21.ova

Notice the csr_mgmt virtual-services-name in the command? Next, you must configure the virtual services container to allow it to run. In order to do this, you must use the same virtual-services-name that was defined during the installation of the application. This is why you can only use the csr_mgmt container name in this command. Otherwise, you are referencing a container for a virtual service that doesn’t exist.

I hope this has been helpful!


Which OS you are using on Pc?

The only thing I can’t seem to find is the x-auth-token header. What exactly is it?

Hello Justin

You may find additional information on this topic at the following Cisco documentation.

If you need further specifics, let us know.

I hope this has been helpful!


1 Like

Assuming the virtual-service command is only available on ipbase and advancedservices images?

I have a C2960x at home running lanbase and it doesn’t have this command.

Hello Laurie

I don’t believe that the 2960 series switches support a shared management interface. It is only available on ASR 1000 routers and up, and only for IOS-XE releases. It is also available on Nexus devices, however. You will have to take a look at the feature sets available on particular IOS versions and platforms. The Cisco feature navigator is always a good place to start.

I hope this has been helpful!


I can’t understand, how can I make/find the ova file to setup virtual-services on the router?

% Virtual service csr_mgmt install has not completed, please activate the VM after install is completed
Router# virtual-service install name csr_mgmt package bootflash:?


Hello Giovanni

In order to be able to perform this lab, you must have two things:

  1. A Cisco device with an IOS operating system release that supports virtual services
  2. An open virtual application (OVA) package that is compatible with the IOS and the device.

The OVA files are typically obtained in the same way that you obtain your system images and are subject to the same copyright limitations as system images. If you are using virtual devices (GNS3, VIRL…) you must make sure the virtual device supports these features. Typically, a CSR1000v should support everything you need.

More info can be found in this Cisco documentation:

I hope this has been helpful!


Very helpful explanations,
A small typo error to correct in the text:
“We used the HTTP GET method to retrieve interface information and the HTTP GET method to update its configuration.”
You can delete my comment after correcting :slight_smile:

I have some basic questions (I am very new to python) :

1- Why an API REST need a token, it could not use the authentification method to get or update the info?

2- the token value is always the same or it can change with time?

3- the server IP is the ip used in the static default route configured on the router?

Many thanks


1 Like