Instructor: And now,
let's talk about the structure of REST API Response.
So, in the response also, we have some components.
First, the Status Code.
The Status Code is a number,
a three digit number, that represent
whether the request succeeded or not.
And if not, what was the problem.
After that, again, Headers,
some Meta-data about the response.
And,
last is the Body.
In this case, as you can guess,
the body contains the contents of the response.
As we will see later in this course,
the body in the response
also liking the request is optional,
and we don't always have a body.
And, here is an example of a REST API Response
and let's look closely at it.
So, this is the Status Code, in this case 200.
200 in the HTTP protocol means, okay,
meaning the request succeeded.
Next, are the Headers.
And, last is the Body.
In this case, the body contains the data
about the resource we asked for.
Remember, that in our example
we used order number 17 as an example resource.
So, here is a representation of the resources state.
In this case, the representation is a JSON.
And you can see in the order number 17, the order date
and what items are included in this order.
We said earlier that the response is usually represented
as JSON.
But this is not always the case.
And sometimes you will use maybe some other formats,
like XML or HTML.
But, it's important to note that these are rarely used.
You should always try to use JSON,
unless dictated other by the client.