WEBVTT
Kind: captions
Language: en

00:00:00.030 --> 00:00:06.629
Next we can test our API view in the
browser so let's load up your browser

00:00:06.629 --> 00:00:11.880
I'm going to use Google Chrome and then
head over to the web server address

00:00:11.880 --> 00:00:19.220
forward slash API forward slash hello -
view

00:00:19.220 --> 00:00:20.540
Once you land on the page you

00:00:20.550 --> 00:00:26.160
should see a response like this which is
the output that is returned in our response

00:00:26.160 --> 00:00:32.219
in our views dot py hello API view so you
can see that we're returning response

00:00:32.219 --> 00:00:37.920
message and we're returning the message
hello so if we go over to our browser you

00:00:37.920 --> 00:00:43.800
can see that we have the message hello
here and then we have our an API View

00:00:43.800 --> 00:00:50.190
key which passes in our list which
describes an API view and you can see

00:00:50.190 --> 00:00:55.800
that this is passed in to the response
here so what happened here when we called

00:00:55.800 --> 00:01:01.620
the response well when you entered
forward slash API slash hello view this

00:01:01.620 --> 00:01:06.510
went to the Django dispatcher which
checked the URLs dot py and then it

00:01:06.510 --> 00:01:12.090
matched the base path with API forward
slash and then it saw that it needed to

00:01:12.090 --> 00:01:17.250
check in the profiles API dot URLs to
find out how to map the rest of the URL

00:01:17.250 --> 00:01:19.300
after API forward slash

00:01:19.300 --> 00:01:23.670
it passed it into this and
it matched it with hello view and then

00:01:23.670 --> 00:01:26.660
it rendered our API view

00:01:26.660 --> 00:01:29.970
So that's how
the views work in Django and that's

00:01:29.970 --> 00:01:35.670
how they map to URLs let's go ahead and
commit our changes to git open up the

00:01:35.670 --> 00:01:40.259
terminal and then head over to a
terminal or git bash window that is on

00:01:40.259 --> 00:01:45.270
our project not connected to vagrant and
we're going to type git add to add any

00:01:45.270 --> 00:01:52.140
new files and then git commit - am and
we'll give it the commit message

00:01:52.140 --> 00:02:01.170
added hello API view and then do git
push origin to push this up to github so

00:02:01.170 --> 00:02:06.860
that's how you create an API view and
configure it to a URL in Django

