1 00:00:04,920 --> 00:00:11,850 In this video, we're going to discuss arrest APIs or representational state transfer application programming 2 00:00:11,850 --> 00:00:12,700 interfaces. 3 00:00:12,720 --> 00:00:15,990 A long name, basically short name, rest APIs. 4 00:00:16,290 --> 00:00:22,170 Application programming interfaces allow us to get one application to interact with another application. 5 00:00:22,410 --> 00:00:28,860 As an example, if you want to use the functionality of Google Maps rather than developing your own 6 00:00:28,860 --> 00:00:34,140 mapping system, you can integrate Google Maps with your application, and then you can send queries 7 00:00:34,140 --> 00:00:39,450 to Google Maps using an application and then get responses back from Google Maps. 8 00:00:39,900 --> 00:00:42,270 Rest APIs are used everywhere. 9 00:00:42,270 --> 00:00:46,800 It's really important that you learn the basics of rest APIs for the CCNA exam. 10 00:00:46,800 --> 00:00:48,990 You don't have to learn Python. 11 00:00:48,990 --> 00:00:54,710 You have to have an understanding of a rest APIs and have an understanding of DNA center. 12 00:00:54,750 --> 00:01:00,720 In this video, however, I'm going to show you how you can interact with a Cisco device using a rest 13 00:01:00,720 --> 00:01:02,850 API and a Python script. 14 00:01:02,850 --> 00:01:07,860 So we're going to write a Python script that interacts with the rest API on a Cisco router. 15 00:01:07,890 --> 00:01:10,980 You once again don't need to learn that for the CCNA exam. 16 00:01:10,980 --> 00:01:14,820 You would need to know that for the Cisco dev net exam. 17 00:01:14,970 --> 00:01:19,230 But it's well worth learning the stuff, as I've been saying, for the real world. 18 00:01:19,230 --> 00:01:22,410 If you want to differentiate yourself from others, it's well worth learning. 19 00:01:22,410 --> 00:01:24,510 Rest APIs well worth learning. 20 00:01:24,510 --> 00:01:25,140 Python. 21 00:01:25,140 --> 00:01:28,290 Now I'm going to cover this section differently to other instructors. 22 00:01:28,380 --> 00:01:35,010 Too many of them say connect to this dev net server, but they're using a prebuilt application or prebuilt 23 00:01:35,010 --> 00:01:41,220 information and it's very difficult to replicate what they're doing if you don't download prebuilt stuff 24 00:01:41,220 --> 00:01:45,420 from Cisco Dev Net, some instructors are simply copying the dev net labs. 25 00:01:45,420 --> 00:01:47,580 They're not actually doing their own thing. 26 00:01:47,580 --> 00:01:49,800 So I want to show you this from the ground up. 27 00:01:49,800 --> 00:01:57,480 I want to show you how you can interact with rest APIs without using prebuilt stuff that's been downloaded. 28 00:01:57,480 --> 00:02:00,420 I'm going to show you how to download an application called Postman. 29 00:02:00,420 --> 00:02:05,610 I'm going to show you how you can manually update Postman with IP addresses and other information not 30 00:02:05,610 --> 00:02:06,660 using prebuilt stuff. 31 00:02:06,660 --> 00:02:11,910 So I'm going to show you how you can overcome some issues that you will encounter if you do this manually 32 00:02:11,910 --> 00:02:13,950 rather than using prebuilt stuff. 33 00:02:14,010 --> 00:02:15,870 There's an issue with certificates. 34 00:02:15,870 --> 00:02:22,170 As an example, you have to tell Postman to accept a self sign certificates, otherwise it won't interact 35 00:02:22,170 --> 00:02:25,110 with the devices that are using self signed certificates. 36 00:02:25,110 --> 00:02:30,120 We're going to manually configure IP addresses rather than once again using prebuilt stuff. 37 00:02:30,510 --> 00:02:34,650 But to make it easier for you, I've created this entire PowerPoint presentation. 38 00:02:35,690 --> 00:02:41,660 In this PowerPoint presentation, I've given you the links to Cisco's dev net labs. 39 00:02:41,660 --> 00:02:44,810 So the definite DNA center always on labs. 40 00:02:44,810 --> 00:02:48,770 Your URL is here, here is the username and here's the password. 41 00:02:48,770 --> 00:02:53,480 So you can simply download this PowerPoint presentation and use it all. 42 00:02:53,480 --> 00:02:55,250 The links are here that I'm using. 43 00:02:55,250 --> 00:02:59,120 All the information is within this document as an example. 44 00:02:59,120 --> 00:03:05,930 Here's the API documentation question people often ask is How do I know what APIs to use while there's 45 00:03:05,930 --> 00:03:09,470 an example of the API documentation for DNA center? 46 00:03:10,430 --> 00:03:14,030 There's also a definite lab that you can follow if you want to. 47 00:03:14,060 --> 00:03:19,670 So if you want to go through one of the dev net labs, there is a good example of a dev net lab. 48 00:03:20,510 --> 00:03:26,980 But what I'm going to show you as an example is how to connect to labs and manually. 49 00:03:26,990 --> 00:03:29,810 So we're going to use Postman, which is an application. 50 00:03:29,810 --> 00:03:31,710 I'll show you in a moment how to download. 51 00:03:31,730 --> 00:03:38,720 It allows you very easily to interact with APIs, allows you to do some basic testing and check for 52 00:03:38,720 --> 00:03:39,470 issues. 53 00:03:39,740 --> 00:03:42,410 Really good application for testing APIs. 54 00:03:43,280 --> 00:03:45,920 So I'm going to show you the URL to connect to you. 55 00:03:45,950 --> 00:03:51,740 I'll show you how to bypass the issue with self signed certificates. 56 00:03:51,740 --> 00:03:57,350 You need to turn this off, otherwise you will have problems if you try and connect to some of their 57 00:03:57,350 --> 00:03:57,650 labs. 58 00:03:57,650 --> 00:04:01,250 It's not going to work because you need to turn this off. 59 00:04:01,280 --> 00:04:04,520 Otherwise, Postman by Default rejects the connection. 60 00:04:05,330 --> 00:04:11,300 All the username and password information is within this document, and I'm showing you step by step 61 00:04:11,300 --> 00:04:12,590 what to do. 62 00:04:12,620 --> 00:04:17,690 I'm going to demonstrate it practically using a video, so I'm going to show you how to do this. 63 00:04:17,690 --> 00:04:23,660 But I've also given you this entire PowerPoint presentation so that you can keep this as reference for 64 00:04:23,660 --> 00:04:24,140 later. 65 00:04:25,380 --> 00:04:28,230 I've also included a Python script. 66 00:04:28,260 --> 00:04:33,330 So this is a very basic Python script that allows me to connect to a Cisco router. 67 00:04:33,540 --> 00:04:37,040 In this example, we're going to connect to a Cisco router. 68 00:04:37,260 --> 00:04:40,620 We're going to connect to this router on this port number. 69 00:04:40,620 --> 00:04:45,540 And then we're going to get a list of interfaces from the router using an API. 70 00:04:46,410 --> 00:04:48,180 So I really hope this helps you. 71 00:04:48,180 --> 00:04:52,620 If you follow along in this video, you should get a really good understanding and I'll show you step 72 00:04:52,620 --> 00:04:58,620 by step how to interact with both DNA center as well as with a XY router, in other words, a Cisco 73 00:04:58,620 --> 00:04:59,160 router. 74 00:04:59,790 --> 00:05:04,530 But you can download this PowerPoint presentation and have it as a reference to really help you. 75 00:05:04,770 --> 00:05:10,890 After you've watched these videos six months from today, you might just want to have this as a reference. 76 00:05:11,370 --> 00:05:11,630 Okay. 77 00:05:11,640 --> 00:05:13,980 APIs are used everywhere. 78 00:05:14,430 --> 00:05:18,750 You probably use them all the time without realizing applications. 79 00:05:18,750 --> 00:05:23,130 Talk to other applications using application programming interfaces. 80 00:05:23,130 --> 00:05:25,770 These are becoming more and more important. 81 00:05:25,980 --> 00:05:32,550 It's very difficult for applications to share information using non structured data. 82 00:05:32,580 --> 00:05:37,890 In a separate video, I spoke about JSON and how you need to use JSON formatting to share information 83 00:05:37,890 --> 00:05:39,240 between devices. 84 00:05:39,660 --> 00:05:41,220 Structured data is really important. 85 00:05:41,220 --> 00:05:46,740 Having a structured application programming interface is really important if you want machines talking 86 00:05:46,740 --> 00:05:47,670 to machines. 87 00:05:48,450 --> 00:05:49,530 He has an example. 88 00:05:49,560 --> 00:05:53,640 Notice that a lamp I press a button on my phone, it goes off. 89 00:05:53,850 --> 00:05:55,110 This is a hue lamp. 90 00:05:55,110 --> 00:05:57,000 It has an exposed API. 91 00:05:57,830 --> 00:06:01,010 Now because of APIs, I can once again do this. 92 00:06:01,310 --> 00:06:03,290 Alexa Turn off. 93 00:06:03,290 --> 00:06:05,720 David Office old big lamp. 94 00:06:07,460 --> 00:06:08,240 Okay. 95 00:06:08,780 --> 00:06:10,580 Notice the lamp went off. 96 00:06:10,610 --> 00:06:13,190 Very simple example of an API. 97 00:06:13,370 --> 00:06:15,550 Alexa, turn on David. 98 00:06:15,560 --> 00:06:17,330 Office old, big lamp. 99 00:06:18,920 --> 00:06:19,670 Okay. 100 00:06:20,390 --> 00:06:28,700 Alexa So that's an example of one program, talking to another program. 101 00:06:29,060 --> 00:06:34,670 We've got a hue lamp system, we've got Alexa and they are talking to each other. 102 00:06:34,670 --> 00:06:40,490 And application programming interfaces allow me to do interesting things like that where I can get one 103 00:06:40,490 --> 00:06:43,930 device to interact with another device and do something. 104 00:06:43,940 --> 00:06:48,590 Now you can use SSH to simply SSH to a broader and configure a router. 105 00:06:48,620 --> 00:06:54,590 The problem is when you type show version or show IP interface brief, that data that's displayed is 106 00:06:54,590 --> 00:06:56,140 for human consumption. 107 00:06:56,150 --> 00:07:01,250 In other words, humans will understand the information, but machines will struggle with the information 108 00:07:01,250 --> 00:07:08,870 that's displayed if the show version command is run on different routers Cisco Nexus, Cisco, iOS, 109 00:07:08,870 --> 00:07:12,380 classic, iOS, monolithic iOS versus iSCSI. 110 00:07:12,410 --> 00:07:16,400 The output will be slightly different and machines will struggle with that output. 111 00:07:16,490 --> 00:07:23,060 What you really want is that my application can talk to your application using an exposed and well documented 112 00:07:23,060 --> 00:07:23,840 API. 113 00:07:24,080 --> 00:07:25,310 Now that's the theory. 114 00:07:25,310 --> 00:07:27,890 In reality, APIs change. 115 00:07:27,890 --> 00:07:31,400 In reality, not all devices use the same API. 116 00:07:31,430 --> 00:07:38,450 So if you talk to DNA center, the APIs that it uses will be different to an iOS errata and it can change 117 00:07:38,450 --> 00:07:39,580 from version to version. 118 00:07:39,590 --> 00:07:46,850 That is a frustration of APIs, but long term, hopefully Cisco will standardize the APIs more and more. 119 00:07:46,880 --> 00:07:49,010 This is where the world is going. 120 00:07:49,010 --> 00:07:53,120 We are no longer going to manually configure devices using the CLI. 121 00:07:53,150 --> 00:07:58,310 You're going to have applications interacting with other applications and programming other applications. 122 00:07:58,310 --> 00:08:04,580 So my program will program that program in the same way that an Alexa can be used to interact with many 123 00:08:04,580 --> 00:08:05,720 devices out there. 124 00:08:06,350 --> 00:08:06,580 Okay. 125 00:08:06,650 --> 00:08:09,620 So let's get started with some practical demonstrations.