Heads up! To view this whole video, sign in with your Courses account or enroll in your free 7-day trial. Sign In Enroll
Well done!
You have completed JavaScript Data Fetching!
You have completed JavaScript Data Fetching!
Preview
Learn what APIs are and why they matter to developers.
Resources
Related Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign upRelated Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign up
Hello there, and welcome.
0:09
I'm Travis,
and I'm an instructor here at Treehouse.
0:10
This course is essentially here
to get you familiar with one concept,
0:13
fetching and using data from an API.
0:17
But before we do so, there's a few things
we need to cover.
0:19
You see,
we could jump straight into fetching data,
0:23
but the core understanding
0:25
of what's actually happening when we do
so would be looked over.
0:26
As developers,
we shouldn't be accustomed to writing code
0:30
that we don't understand
just because it works.
0:33
So we're gonna take things
back to the beginning, but don't worry.
0:36
We won't stay in the past too long.
0:39
So you might have heard the term before,
but what exactly is an API?
0:41
And more importantly, why do we care?
0:45
API stands for application
programming interface.
0:48
That's just a fancy way of saying
it's a set of rules that lets programs
0:52
talk to each other.
0:55
For developers, it usually means a way
for your code running in the browser
0:57
to ask a server for data
or send data back in a structured way.
1:01
I love food,
so I like the restaurant analogy.
1:05
You can think of an API
like a waiter in a restaurant.
1:08
You don't go into the kitchen and cook
the food yourself.
1:11
That's why we go out to eat.
1:14
You inspect the menu
and find what you want.
1:15
We can think of the menu
as the API documentation.
1:18
You tell the waiter what you want, and
you wait for them to bring it back to you.
1:22
The food you get
is like the data from the server.
1:25
Now modern
1:29
websites
and apps don't just show static content.
1:30
They need to request information
1:34
from servers and update the page
dynamically without reloading.
1:35
APIs are how this is done.
1:39
Have you ever been scrolling
1:42
through a feed on a social media site
and realize it never ends?
1:43
You get to the bottom and more posts
appear.
1:47
Obviously, your device didn't load
millions of posts all at once.
1:50
That would take forever.
1:53
The app is calling an API when it realizes
it needs more posts to display to you.
1:54
So later in the course,
we're going to build a small interactive
2:00
app with data we're fetching from an API.
2:03
But as I mentioned earlier,
2:05
there's a few things
you should know first, so let's get to it.
2:07
You need to sign up for Treehouse in order to download course files.
Sign upYou need to sign up for Treehouse in order to set up Workspace
Sign up