In Cisco SD-WAN vManage 19.2 change have been made that requires the use of a token in the headers for any API interaction to work
This public repo contains python code that can be used to interact with the Cisco SD-WAN vManage REST API
. The environment is pre-configured to access the Cisco DevNet Reservable Sandbox for SD-WAN fabric.You can edit the variables in the environment to point to your own vManage instance. The code contains REST API calls to authenticate, get a list of devices that are part of the SD-WAN fabric. Cisco SD-WAN vManage 19.2.2.
It is recommended that this code be used with Python 3.6. It is highly recommended to leverage Python Virtual Environments (venv).
Follow these steps to create and activate a venv.
virtualenv venv --python=python3.6
source venv/bin/activate
pip install -r requirements.txt
- Send POST request for authentication with vManage web server.
- Method:
POST
- Request URL:
https://vmanage-ip:vmanage/j_security_check
- POST Request Payload:
{'j_username' : username, 'j_password' : password}
- Once login is successful run GET request to retrieve token and add it to session headers of subsequent API calls.
- Method:
GET
- Request URL:
https://vmanage-ip:vmanage/dataservice/client/token
- Store the response token value in session headers
“sess.headers['X-XSRF-TOKEN']”
- Method:
GET
- Request URL:
https://vmanage-ip:vmanage/dataservice/device
Network Automation Developer Advocate for Cisco DevNet. I'm like Hugh Hefner... minus the mansion, the exotic cars, the girls, the magazine and the money. So basically, I have a robe.