Bummer! This is just a preview. You need to be signed in with a Pro account to view the entire video.
The HTTP Response1:16 with Naomi Freeman
In this video, we explore the relationships between HTTP headers and responses.
Now we're going to talk a little bit more about the specifics of an API.
When you send a GET request and
the server sends the okay back, what is actually sent back to you?
By default an HTTP response is typically composed of two parts,
the message Header and the message Body.
There are some exceptions and you can tell it to do otherwise.
The header defines the operating parameters of an HTTP transaction,
what can be accepted, how, where it came from.
It looks a little terrifying, but it's really not,
and that's why we're gonna talk about this.
The message body is optional and may tell the users some information.
Sending a body along is often considered expensive.
Every action you perform costs data,
and it is often advisable to send as little data as possible.
It adds up over time.
There are cases when we may want to tell our user more explicitly what is going
As we've already learned, APIs can return this information in a variety of formats.
For our API, we're just going to keep it simple and have everything return in JSON.
Up to 32 different formats are supported out of the box though.
Now that we know a bit more about what an API is, let's get building.
You need to sign up for Treehouse in order to download course files.Sign up