Modern APIs with FastAPI and Python Transcripts
Chapter: Accepting inbound data
Lecture: Calling the POST method with RESTful tools

Login or purchase this course to watch this video and the rest of the course contents.
0:00 While our browser will let us do get requests really easily, over here,
0:04 doing a post, while possible with some browser
0:07 addon tools and whatnot, is not the best place to be doing that kind of stuff.
0:10 So let's go over here to a tool called Postman.
0:13 Postman is a freemium app
0:15 you can check out and it lets you do all sorts of interesting requests.
0:18 Like here we go like this.
0:20 Let's get something back, like "weather slash portland" and run it.
0:24 Here you can see our report showing up down there,
0:26 right? But what we want to do is submit some data.
0:29 Look at all these http verbs.
0:31 We're gonna do a post and in order to do a post, well,
0:34 we could send some stuff over.
0:36 It's gonna say we're missing stuff.
0:38 What are we missing? Just the body.
0:40 There's nobody submitted. Come over to the body and say
0:43 this is raw JSON, make this a little bit bigger.
0:47 And I happened to leave, I didn't leave that tap open. Too bad.
0:51 Let's go and generate it real quickly just to get an example here.
0:55 Let's go put this back.
0:56 This will tell us what goes here, and look at the raw data.
1:00 We got to submit one of those, basically. Put it back.
1:03 Alright, So what we're gonna do is we're going to submit basically this right
1:06 here. But remember, we could put a better description.
1:09 We could omit the state. We could omit the country, if we wanted.
1:13 ID We're not going to submit, the created date
1:15 we're not going to submit. Okay,
1:17 so the description is there is heavy rain,
1:21 and this will be Portland. Let's go for the state is gonna be Oregon, just
1:26 to be explicit. Now, if we submit that body,
1:29 we might not have this missing field.
1:32 Let's go. Yes. Look at that.
1:34 What did we get back? Well,
1:35 first of all, we got a 200
1:37 ok. That's not perfect, but that's a good sign.
1:39 And then it says there's heavy rain.
1:41 Here's the location. And it look,
1:43 it created an ID and set the date,
1:45 so it saved it to the database.
1:47 And how do we know? We can come over here and do a get against that
1:50 URL. get, get,
1:52 get, and look. Here it is.
1:53 Let's submit one more thing. Because there was that heavy rain,
1:58 we saw a little bit of flooding,
1:59 so we send that again. Now if I do a get request against this and
2:04 see, here's the little flooding and there's heavy rain and again the sorting is working great.
2:09 How cool is that? So here's how we can go and do a post
2:14 and all the http verbs and really nicely work with our API and test it out.