Yo, what's up?
Welcome to the Jango API course.
Before we get started here, I want to make sure we have two things clear.
The first one is, is that you should have some Django experience before you take this course.
If you're a complete newbie to Django period, I would highly recommend going and checking out my Django
three course or some sort of equivalent intro to Django thing so that you least have a basic understanding.
Now, assuming that we've got that out of the way.
The next question is, is this the right course for you?
Why do you want to create an API with Django?
Well, what I'd like to do here in this video is talk about what API is are and why they're important.
And I think by the end of this, you'll be able to answer the question of do I want to build an API?
I suspect you do.
Said you signed up for the course, but let's make sure we're all on the same page.
Now, what is an API?
It stands for application programming interface.
That doesn't matter.
No one cares what the technical definition is.
In the end, there's lots of different API is when we use this word, like, for example, when you're
developing a Mac or IOW applications, there's an API to connect with the operating system.
But that's not the type of API that we're talking about.
We're talking about a Web API, essentially a way for two computers to talk to each other.
So this gets into why APIs are so important.
So, for example, lots of social media sites like Twitter and Facebook have API.
And the reason that they have them is, for example, let's say I wanted to make a Web site that goes
and gets the top trending tweets from Twitter and it displays them on my own Web site in some sort of
cool, fashionable way.
Right.
Well, I could make a program that goes to Twitter, dot com clicks on the trending tab and then, you
know, goes and copy's K, number one.
Number two, number three.
And, you know, I can even, you know, look at the actual H.T. AML code behind Twitter dot com.
And I can, you know, highlight specifically the different things that are there.
But this is really inefficient.
This is called web scraping, by the way.
And the reason that it's very inefficient is because Twitter could change the way that their home page,
home page looks at any time, like maybe they'd move the trending tab to the right size of news.
And maybe, you know, the particular ideas that they use for these A.T.M. tags is going to change.
Anything could happen here like Twitter.
Dot com is a great way for me as a human to interface with Twitter.
But if I'm trying to build a website or an app that gets information from Twitter, well, it's really
terrible.
So what we have then is a Twitter API and if we go ahead and search the Twitter API.
There is tons of documentation showing how we can go and grit, get different tweets from from places,
right.
And it says, OK, if you go ahead and, you know, want to get the timeline for a particular user,
you can go here.
This is the you are all that you should be going to and this is how it's going to look when it comes
back.
Like this is information that a computer can rely on.
Basically Twitter saying I'm going to output my information like this and I'm always going to output
it like this so that you can make sure that you can consume it the same way.
So if this still isn't exactly making sense, let me go to a lot simpler example.
So let's go to my Web site.
Zappy code dot com.
OK.
So here on Zappy Code, I have courses where if you remember on my Web site, you get access to these
courses.
And here you can see there's three right now.
And, you know, someone could go to zappy code dot com slash courses and go look at these.
But what if I wanted to build, again, some Web site or app that always listed out the different courses
that zappy code offers?
Well, if I tried to get just the raw H-E email here, I'm probably going to be changing the design
of this Web site at some point.
Like, as you can tell, it's not the greatest thing in the world.
I try and make it fun, but, you know, maybe someday I'll say all this purple text, you know, isn't
worth it.
But I have an API.
So if you go to zappy code dot com slash API slash courses, OK.
You then get an API showing exactly what all the courses are, but in this very machine readable format.
Now what is this particular format?
The one that you see here is called Jason.
So there's lots of different ways to display data.
It could be X Amelle CSF vs Jason, but pretty much at this point, the most popular one that you see
almost everywhere is Jason.
It's considered the standard.
So if you go ahead and just look at this, this is sort of like a pretty way to view the API.
The real raw API is if you go ahead and change this, to say I want to get this in strict Jason, it
looks like this just a big jumble of text, but it has all the right information there.
Now, if we wanted to see this a little bit more pretty.
Like, for example, how it automatically did it for us here.
If we go ahead and open up a new tab, we can search for it.
Jason Validator.
Jason, is this whole spek that if you're going to send data back and forth with Jason, it has to adhere
to the rules?
So there's all these different formatters that will allow you to sort of check and say, hey, is my
Jason accurate?
So, for example, here, I can go ahead and select all this, Jason and I can paste it into here and
say, hey, I want to make sure that this is valid.
So I'm going to validate it.
And it says, yes, it's valid.
And a nice side benefit is most of these validators will sort of organize it for you.
And you can see when I do it like this, it's like, oh, OK, there's three classes.
You know, each of the classes has like a release date, an image that I could link to a title and a
subtitle.
That's really nice.
So this API allows us to see essentially the same thing as this.
I'm going to go to Zappy COCOM slash courses.
OK, so this is sort of the human readable one.
This is the computer readable one.
So the reason that API is are important is they allow computers to be able to talk to each other in
some sort of defined way that when someone puts out an API, they're essentially saying, I promise,
I'm always going to deliver the data like this.
For example, with my API here, I'm always going to provide the I.D., the release date, the image,
the title.
I'm not going to change this to capital title, for instance, like you can bank on the way that this
is going to come out.
Now, there may be new courses, there may be a new course that has an idea of seven.
That is not not a jingo three course.
Maybe at that point it's a jingle for course.
Who knows what's coming out in the future.
But I know that there's going to be an array of courses that has this particular format to get the different
pieces of information.
So with that in place, hopefully you've got a good grasp of, you know, hey, maybe I do want to build
an API is to just kind of talk about the reasons why one could be, for example, you want to build
a mobile app.
If I wanted to create a mobile app of Zappy COCOM, I would have to build out Nolde whole API that lists
out the courses.
Banaz, not just the courses it be even the lectures here that are all listed out.
I need would need to be able to get that information.
There's like a whole, you know, log in and sign up system months AP code.
I would have to integrate all of that.
There's a lot of steps that go into play to building that, but an API is the way to do that.
Another one is maybe you just want to broadcast some sort of information, like a really common one
is you'll see whether API.
So if you want to have an app that takes advantage of the user's location and says, hey, you know,
this is what the weather's going to be for you today, you could use a weather API to do that.
And there's tons of Web sites that will offer that for you.
So if you think you're ready to go build an API for yourself, let's go ahead and get started right
now.