Understanding the Basics of API
An application programming interface (API) is a software interface that allows two applications to talk to each other. Simply put, an API is a courier that delivers your request to the server that you are asking for information from and delivers the server’s response back to you. The most common type of API is a Representational State Transfer or REST API. This is essentially a set of guidelines for building a web service and is based on uniform resource identifiers, or URIs, and the HTTP protocol. REST APIs are uncomplicated, require little server overhead and are extremely scalable.
There are two types of REST APIs: stateless and stateful. Stateless means that the state of the request, known as a service, doesn’t continue on between subsequent requests and responses. Each request carries its own user credentials and is individually authenticated. Stateful APIs in comparison, require the server to save the status and session information between requests.
The difference between stateless and stateful is similar to making a call to your bank. In a stateful request, the bank would first ask you a series of questions in order to positively identify you as the person authorized to make the requested transactions. After your first transaction, you could ask the bank to make an additional transaction on the same call. The bank would not need to ask you to identify yourself again. For stateless requests, you would have to end the call and redial the bank after each transaction. In this case, you would be required to re-identify yourself to the bank, as the information you gave in the first call would not carry over to the second call.