1 00:00:00,000 --> 00:00:03,960 [MUSIC] 2 00:00:03,960 --> 00:00:09,700 Hi everyone, I'm Kenneth and I'm a Python programmer and teacher here at Treehouse. 3 00:00:09,700 --> 00:00:13,320 If you're a fan of Flask, you've probably taken our other two Flask courses. 4 00:00:13,320 --> 00:00:16,890 If you haven't, I highly suggest you take at least Flask basics. 5 00:00:16,890 --> 00:00:19,010 I'll put a link to it in the teacher's notes. 6 00:00:19,010 --> 00:00:21,850 This course is going to be a little different from both of those though. 7 00:00:21,850 --> 00:00:24,660 Because we're not going to be building a web site. 8 00:00:24,660 --> 00:00:26,290 We're going to build an API, 9 00:00:26,290 --> 00:00:28,696 so I guess you could say we're building a web service. 10 00:00:28,696 --> 00:00:34,160 Web APIs are a way for other websites, mobile apps, desktop apps or 11 00:00:34,160 --> 00:00:39,070 even your own site to use your data in a safe secure and sanitized way. 12 00:00:39,070 --> 00:00:42,030 Users don't have to try and scrape data off of your website and 13 00:00:42,030 --> 00:00:45,890 then scramble to fix their data gathering tools whenever you update your site. 14 00:00:45,890 --> 00:00:48,180 And you don't have to worry that they'll somehow scrape or 15 00:00:48,180 --> 00:00:49,790 distribute sensitive information. 16 00:00:49,790 --> 00:00:50,310 It's a win win. 17 00:00:51,520 --> 00:00:54,740 Our API is going to take advantage of the REST design pattern, 18 00:00:54,740 --> 00:00:57,160 which I covered in REST API basics. 19 00:00:57,160 --> 00:01:00,240 Again if you haven't seen it, I'll link to it in the teacher's notes. 20 00:01:00,240 --> 00:01:04,040 Our rest API is going to be for a service that collects online tutorials and 21 00:01:04,040 --> 00:01:05,490 reviews for them. 22 00:01:05,490 --> 00:01:08,930 You could go on there and submit your favorite Python courses, wink, wink. 23 00:01:08,930 --> 00:01:11,020 And then people could leave reviews about them. 24 00:01:11,020 --> 00:01:13,170 In fact, I have a few reviews right here. 25 00:01:14,850 --> 00:01:18,060 All right, I guess we can save them for another time. 26 00:01:18,060 --> 00:01:19,521 Let's talk about the design of our service. 27 00:01:19,521 --> 00:01:23,630 At /courses, we'll let users use two methods. 28 00:01:23,630 --> 00:01:25,050 Get and post. 29 00:01:25,050 --> 00:01:27,480 Get. We'll get back all of the existing courses 30 00:01:27,480 --> 00:01:29,468 and post will add a new course to the collection. 31 00:01:29,468 --> 00:01:33,530 Then at /courses/5 for example. 32 00:01:33,530 --> 00:01:34,970 We'll provide three methods. 33 00:01:34,970 --> 00:01:36,870 Get, put, and delete. 34 00:01:36,870 --> 00:01:40,870 When you get a course with an ID, you'll get back just that course. 35 00:01:40,870 --> 00:01:43,350 If you put to the course, you'll update it. 36 00:01:43,350 --> 00:01:46,770 And as I'm sure you can guess, sending a delete to a course will delete it. 37 00:01:48,220 --> 00:01:51,210 Our second resource will be at /reviews. 38 00:01:51,210 --> 00:01:54,990 Get and post here will work just like they do for /courses. 39 00:01:54,990 --> 00:01:59,854 Get, put and delete on our review with an ID like /reviews/15 will work like 40 00:01:59,854 --> 00:02:01,532 they do for courses, too. 41 00:02:01,532 --> 00:02:05,820 We'll also end up making a third resource before the course is over. 42 00:02:05,820 --> 00:02:08,350 But these two are plenty for us to get started with. 43 00:02:08,350 --> 00:02:11,990 Before we do that though, I think this is a great time to go over these reviews. 44 00:02:13,320 --> 00:02:14,280 All right, fine. 45 00:02:14,280 --> 00:02:15,180 I get it, it's tacky. 46 00:02:15,180 --> 00:02:16,430 I should just give up. 47 00:02:16,430 --> 00:02:16,960 On the next video