Backend
Backend
● Application programming interface is simply a way for two pieces of software to talk to
each other.
HTTP Request
Headers and Body
● Headers contain additional metadata about the request for example the accept header
tells the server which type of content that the client will accept back which more often
than not will be JSON the headers also handle things like authorization to determine if
the user making the request is authorized to do so.
● After the headers, we have the body which is typically in JSON format and it contains a
payload of data that the server can use to update something or create a new record on
the server.
HTTP Response
● HTTP response message to go back to the client it also has a very specific format with
a start line that contains the status code there are a bunch of different status codes and
they're used to tell the client what happened to their request if everything worked then
you should get a 200 status code which means okay codes at the 200 level means
success codes at the 400 level mean that you did something wrong and codes at the
500 level mean the server failed for some reason.
● Then below that we also have a body which contains the actual content that the
server is sending back down to the client which is often JSON data or HTML to use
in a front-end application.