#100DaysOfCode in Python Transcripts
Chapter: Days 97-99: Building JSON APIs
Lecture: Exercising the API
Login or
purchase this course
to watch this video and the rest of the course contents.
0:00
Alright, we have the stubs for our APIs in place.
0:04
And we're going to start focusing on
0:06
some of these that are easy.
0:07
For example, this all_rolls, this one is really easy.
0:11
top_scores, somewhat easy.
0:13
play_round, we're going to save that one for later.
0:15
But I've already sort of configured
0:17
Postman to deal with this.
0:19
So Postman is cool because you can create these groups,
0:21
like here I have Online RPS,
0:24
and here are all the operations,
0:26
and you can see GET, PUT, POST, POST, GET, GET, GET.
0:28
So if I go get_user, we have api/game/users/mark,
0:32
and you can see down here would find user Mark.
0:36
Come over here and say create_user,
0:37
the body's already set,
0:38
here's the user that didn't exist yet.
0:42
But if we do this,
0:45
response is would create user 200 okay.
0:49
So what we're going to do is we're going to
0:50
go through and work on these.
0:51
Let's start with all_rolls.
0:53
Right now we're getting would create all_rolls.
0:55
I think we're going to start knocking out
0:57
some of these simple ones, game_status, all_rolls,
1:00
new game, create user, these types of things.
1:02
And then the play_round and the top_scores
1:04
those are a little bit trickier.
1:06
But you'll see that we can configure these in Postman
1:10
like for example, this play_round is going to pass the body,
1:14
here's the game id, here's the user, here's the roll,
1:17
alright, so we're going to want to make sure
1:19
we have a user, we could create a user over here,
1:23
want to make sure we have, Michael for example,
1:25
so that other one would work.
1:27
Things like that. So we're going to use Postman to exercise
1:30
and get our API just right,
1:32
and then, then we're going to go write
1:34
the client side code that consumes it.