An API (Application Programming Interface) allows users or applications to interact with each other, making communication with the underlying service easier for both the service itself and the user calling it. This course covers the basics of what an API is, how it functions, and why you would want to use one.
- Understand the basics of APIs
- Learn about HTTP and internet communication
- Understand the difference between HTTP and REST
Solutions architects, developers, or anyone interested in learning about APIs.
A basic understanding of internet technology.
Now that we know that an API is just a way to facilitate communication between a service and a user, we can begin to discuss the methods in which that can happen.
Most communications over the internet is achieved through the use of the HyperText Transfer protocol or HTTP. It is a server-client protocol that allows you to fetch resources, such as documents, images, videos, scripts, and what have you over the internet.
HTTP follows the synchronous request and response model. This is a message exchange pattern where the requester sends a request message to a system, which receives and processes the request, and eventually will send back a response.
The HTTP protocol has many different methods you can use to communicate. Each of them tells the server what it should do with a particular request.
Here is a list of every method, but the most common ones are: GET, POST, PUT, and DELETE.
The GET method allows you to request a specific piece of data from a server. This is what your browser uses to retrieve a webpage when you type in www.cloudacademy.com for example.
POST is a request to add new data to a server. This could be used to add a comment to a youtube video.
PUT is used to update some existing data - like editing that previous comment.
And DELETE is pretty self explanatory.
There are also rules for describing the responses from the server. Each response includes a numeric response code. The response codes help to tell the client how to handle the response.
The codes are numbered between 100 to 500, and some are probably very familiar to you.
For example, you are probably familiar with the 404 status code which is the server telling you that the thing you were looking for was not able to be found. You may also have seen the 200 status code which means everything went as expected.
Each different level of code, 200, 300, etc, has a different type of meaning. 200 responses generally mean everything went ok. 500 codes mean a server had a problem generating a response. 300s covers redirections, and the 400 range indicates there are problems with the request on the client's side.
William Meadows is a passionately curious human currently living in the Bay Area in California. His career has included working with lasers, teaching teenagers how to code, and creating classes about cloud technology that are taught all over the world. His dedication to completing goals and helping others is what brings meaning to his life. In his free time, he enjoys reading Reddit, playing video games, and writing books.