1 00:00:00,199 --> 00:00:02,639 We've seen how Postman helps with 2 00:00:02,639 --> 00:00:04,890 testing of APIs, but Postman also 3 00:00:04,890 --> 00:00:06,630 provides its own API that we can use. 4 00:00:06,630 --> 00:00:08,610 We've been learning a lot about APIs, 5 00:00:08,610 --> 00:00:10,259 and if we want to we can use that 6 00:00:10,259 --> 00:00:11,940 knowledge to run Postman itself through 7 00:00:11,940 --> 00:00:14,190 an API. So we might want to do this if we 8 00:00:14,190 --> 00:00:15,869 want to integrate Postman into existing 9 00:00:15,869 --> 00:00:17,580 build processes, or if we want to share 10 00:00:17,580 --> 00:00:18,990 data with some other tools that were 11 00:00:18,990 --> 00:00:20,910 using. So the first thing that we'll need 12 00:00:20,910 --> 00:00:23,190 to do is get an API key, this will allow 13 00:00:23,190 --> 00:00:26,190 us to access the API. So I've logged into 14 00:00:26,190 --> 00:00:29,850 the web Postman Co here, I'll go to my 15 00:00:29,850 --> 00:00:33,699 workspace and integrations, 16 00:00:33,699 --> 00:00:38,260 and we'll go to the Postman API here, the 17 00:00:38,260 --> 00:00:40,600 Postman API integration, and then click 18 00:00:40,600 --> 00:00:42,909 on get an API key. So it's created this 19 00:00:42,909 --> 00:00:45,159 API key for us, and I'll just copy this 20 00:00:45,159 --> 00:00:46,899 so that we have it available for use 21 00:00:46,899 --> 00:00:49,359 later. And now at this point we'll get I 22 00:00:49,359 --> 00:00:50,619 guess a little meta, and we'll use 23 00:00:50,619 --> 00:00:53,589 Postman itself to call the Postman API. 24 00:00:53,589 --> 00:00:57,549 So let's go over to Postman and let's 25 00:00:57,549 --> 00:01:00,430 create a collection here, we'll call it 26 00:01:00,430 --> 00:01:04,809 Postman API, create that, and for the 27 00:01:04,809 --> 00:01:07,659 Postman API we'll put a request in there, 28 00:01:07,659 --> 00:01:12,759 and let's call this get collections, save 29 00:01:12,759 --> 00:01:15,970 that. And then let's go open that request, 30 00:01:15,970 --> 00:01:20,340 and here we can put in the URL to the 31 00:01:20,340 --> 00:01:24,970 Postman API. So API dot, in this case 32 00:01:24,970 --> 00:01:28,860 we'll say get Postman comm slash 33 00:01:28,860 --> 00:01:32,440 collections. And now we can't quite send 34 00:01:32,440 --> 00:01:34,119 this yet, we need to authorize it, so we 35 00:01:34,119 --> 00:01:37,509 need to let Postman know that we are who 36 00:01:37,509 --> 00:01:39,250 we say we are, and we can do that by 37 00:01:39,250 --> 00:01:44,500 passing this header to it, so X API key. 38 00:01:44,500 --> 00:01:48,490 And this header is in the documentation 39 00:01:48,490 --> 00:01:49,810 it tells you that this is what you need 40 00:01:49,810 --> 00:01:52,479 to do to authenticate the API. And we'll 41 00:01:52,479 --> 00:01:54,549 paste in our API key, and then we can 42 00:01:54,549 --> 00:01:56,679 send that request off and get back a 43 00:01:56,679 --> 00:01:59,020 list of all the collections that we have 44 00:01:59,020 --> 00:02:01,210 in Postman. Now you wouldn't really want 45 00:02:01,210 --> 00:02:02,560 to do this obviously and Postman 46 00:02:02,560 --> 00:02:03,909 itself because you already have that 47 00:02:03,909 --> 00:02:06,009 data, but if you were calling this from 48 00:02:06,009 --> 00:02:07,450 another tool that might be helpful for 49 00:02:07,450 --> 00:02:10,199 you. There are also a number of other 50 00:02:10,199 --> 00:02:13,030 endpoints available in the Postman API 51 00:02:13,030 --> 00:02:14,560 documentation, you can see here's the 52 00:02:14,560 --> 00:02:16,660 collection one, and there's whole number 53 00:02:16,660 --> 00:02:18,880 of other endpoints that are available in 54 00:02:18,880 --> 00:02:20,500 the documentation, you can read through 55 00:02:20,500 --> 00:02:22,480 that and see if there's any that you 56 00:02:22,480 --> 00:02:24,760 need or that are useful for you there. So 57 00:02:24,760 --> 00:02:27,100 that covers the Postman API and at least 58 00:02:27,100 --> 00:02:29,109 get you started with it, it's the same as 59 00:02:29,109 --> 00:02:30,549 a lot of the other APIs that we've been 60 00:02:30,549 --> 00:02:32,620 talking about along the way, so you 61 00:02:32,620 --> 00:02:34,540 should be able to pretty easily figure 62 00:02:34,540 --> 00:02:36,430 out how to use the particular commands 63 00:02:36,430 --> 00:02:38,380 that you want from there. In the next 64 00:02:38,380 --> 00:02:39,910 section we'll be looking at how we can 65 00:02:39,910 --> 00:02:42,430 use Postman for data driven testing, see 66 00:02:42,430 --> 00:02:47,430 you there.