Forum Discussion
Ashley_S_Penney
Nimbostratus
Apr 12, 2014Ability to retrieve routes over REST?
Hi,
I currently have code to fetch static and management routes via SOAP, and I'm tinkering with the rest API as an alternative. However I'm surprised to get:
[60] pry(main)> JSON.load(@tr...
JRahm
Admin
Apr 12, 2014in python, I get this:
>>>import requests.session()
>>>b = requests.session()
>>>b.auth('admin', 'admin')
>>>b.verify = False
>>>b.headers.update({'Content-Type': 'application/json'})
>>>b_url_base = 'https://192.168.6.5/mgmt/tm'
>>>routes = b.get('%s/net/route/' % b_url_base)
>>>print routes.text
{"kind":"tm:net:route:routecollectionstate","selfLink":"https://localhost/mgmt/tm/net/route?ver=11.5.0","items":[{"kind":"tm:net:route:routestate","name":"r1","partition":"Common","fullPath":"/Common/r1","generation":1,"selfLink":"https://localhost
/mgmt/tm/net/route/~Common~r1?ver=11.5.0","gw":"10.10.10.1","mtu":0,"network":"172.16.31.88/29"},{"kind":"tm:net:route:routestate","name":"r2","partition":"Common","fullPath":"/Common/r2","generation":1,"selfLink":"https://localhost/mgmt/tm/net/route
/~Common~r2?ver=11.5.0","gw":"10.10.10.1","mtu":0,"network":"192.32.32.0/24"},{"kind":"tm:net:route:routestate","name":"r.default","partition":"Common","fullPath":"/Common/r.default","generation":1,"selfLink":"https://localhost/mgmt/tm/net/route/~C
ommon~r.default?ver=11.5.0","gw":"10.10.10.1","mtu":0,"network":"default"}]}
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
DevCentral Quicklinks
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com
Discover DevCentral Connects