Welcome to EveDumps This is a free, Complete course for the CCNP 350-401 ENCOR Exam Training. I showed you how to interact with the REST API of a iOS XE device. We used the Postman application to send commands to that device. So as an example by using the REST API, We could retrieve a list of interfaces. We could also create a new interface or delete an interface using Postman In this article.

I'm gonna show you how to interact with the REST API of the iOS XE device using a Python script. Remember this is where we going. When we've got many many devices, We want to interact programmatically with those devices using a well known, Exposed API So, Rather than having to manually type commands on the CLI, We're going to programmatically send commands to the device to get it to do things such as create An interface or just to retrieve information from that device, It again doesn't make a lot of sense if you've only got one device makes a lot more sense. When you've got many devices In this article.

However, I just wanna get you started with the basics, So we're going to interact with a single device, A iOS XE device hosted in the DevNet Sandboxes. This isn't always on sandbox, So you can access the device just like I am and try things for yourself. Let's get started (upbeat techno music). In this example, I'm running an Ubuntu 18 zero four, Three virtual machine in VMware Fusion on my Mac. Now you could do it directly on a Mac, But I'm gonna do it in Ubuntu, So that if you're using a Windows machine, I would suggest you run an Ubuntu shell or run an Ubuntu VM or something Seriously.

Linux is the way to go So just learn. Linux, So I'm gonna do this by creating a file called ex dot py. In a previous article, I showed you how to install Python on Ubuntu, So I'm assuming that's already done What I've done here is created a script that imports requests. Requests is a great way to interact with a web interface such as a REST API. So again, Rather than reinventing the wheel, I'm just gonna import that library and then you'll see that my code is very simple: I'm going to allow self signed certificates, So I'm going to add this so that it ignores self signed certificates.

Here are our credentials So copy that, To my Ubuntu computer paste that in that's the first part of the code, Second part of the code is notice the URL. This is exactly the same URL that we used in Postman. It's exactly this URL, But I've got that in a Python script now Notice the headers here we've got Content-Type application Accept application, Yang-data JSON. That is the same as here Now.

As I said, You can get away just using Accept, But for a POST I had to use, Accept and Content -Type. So here I've just got both in the script And what we gonna do is run a GET. This is a variable that stores that information.

So we doing requests dot GET. This is a method of requests. We are going to use this URL specify our username and password, Which was specified over here, Headers that we're using are these headers and we not going to verify our certificates So copy that and paste that in to the Ubuntu server. So here is our entire script. Very simple only a few lines And then I'll save that script and I'm gonna run Python three xe dot, Py And hopefully we'll see the interfaces on the Router and there you go All the interfaces on the Router.

These HavI once again who configured Gigabit two on the Router: But just to prove the point: let's go to Postman and let's create interface, Loopback, 1, 2, 3, 4 and click send and go back to the Python script and run it again. Notice. We'Ve created loopback, 1, 2, 3. 4.

Cisco DevNet 300-910 Dumps

Let's create loopback, 1, 2. 3. 5. That tells me it's created, Run my script again There.

It is, And just for fun. Let's duplicate this and what we'll do is in the body say: let's create a loopback of 2000 and let's say I can see this using Python and let's make this two dot: two dot, Two dot. Two click send It's now being created back in Ubuntu Python. Three ex dot py There you go Just a quick interruption in this article. I showed you how to use GET, But I wanna show you more than that. So I've created an additional article where I show you how to use POST to create interfaces, Delete how to delete interfaces, But I'm not just gonna show you how to do that.

For one interface, I'm gonna show you how to use a loop to do that for multiple interfaces, But the article got too long, So I didn't wanna edit to this article. So just note there's more coming than just this article. This is a short article just showing you how to use a basic Python script using a GET to retrieve information from a Router, But in a subsequent article, I'm gonna show you how to do a lot more than this . So I've shown you how to get a list of interfaces using a REST, API and Postman.

Then I showed you how to do that using a Python script. I showed you how to create interfaces using Postman. I showed you how to delete interface using Postman Postman is a great way to get started if you're, Not sure about the coding, Then use the Graphical User Interface to get started I've once again, Given you all the steps in this PowerPoint presentation, So download the PowerPoint Presentation and just follow the steps, And you should be able to do this yourself.

Hopefully, You've learned something, Hopefully you're now more comfortable using a REST API. But in addition to help me please, Like this article, Please consider subscribing to my EveDumps channel and clicking on the bell to get notifications. That really does help me with EveDumps robots. So if you don't mind doing that, I'd really appreciate it.

I wanna wish you all the very best (upbeat techno music)

Cisco DevNet 300-910 Dumps that Questions and Answers with Explanations Answers that Have Been Checked And Confirmed By Subject Matter Experts. EveDumps Guaranteed to Pass with a Perfect Score Over many satisfied customers. A success rate of 99 percent Free Update. You will get a discount of 20%. PDF and VCE Test Engine are also included.

Comments

Leave a comment