Hey everybody, welcome back.
REST APIs this lesson.
API, it's an acronym that stands for Application Programming Interface.
It's an interface that lets one computer program interact with
another computer program and rest.
Not rest as in take a deep breath and relax.
It's another acronym that stands for
Representational State Transfer which actually isn't all that helpful either.
Purists will be happy to explain to you at length
the more abstract meaning for Representational State Transfer.
But in everyday parlance,
a REST API just means a website that produces
data intended for another computer program to consume,
rather than something intended to be displayed to people in a browser.
A REST API will respond to requests in
a particular format and some things are common across many APIs about the format,
but some things are specific to the particular API.
This week, you'll learn how to write programs in Python that interact with REST APIs.
You'll learn to read the documentation in order to figure out
the specific format that the API is expecting,
and you'll learn how to use the Python request module to make the API calls.
Finally, you'll learn about caching as a way to
reduce the total number of calls that you have to make to the APIs.
Before we dive into details of request APIs though,
we're going to take a little detour to give you some background on what
goes on behind the scenes when two computers talk to each other over the Internet.
It'll give you a mental model of what's going
on so that if things don't work perfectly the first time,
and they never do, you'll know how to think about
what might be going wrong and have a good path toward fixing it.
At the end of this lesson,
you'll be able to parse a URL into its component parts,
the protocol HTTP or HTTPS,
the host, typically a domain name, and the path.
You'll also be able to use the Python request module to fetch the contents of a URL.
Let's get started. I'll see you at the end.