API + REST = RESTful API
In previous blogs, I’ve tried to clarify what an API (Application Programming Interface) is and define the components of a RESTful (Representation State Transfer) program. Now, I want to combine those to talk about a major concept that I’ve seen repeatedly in my job search: RESTful APIs.
My main takeaway on an API is that it is the software in the middle that allows two applications to talk to each other. It takes a request and tells the system or server of the other applications what to do before returning the response. This also allows somebody to take advantage of another pre-built application instead of building everything from scratch. The API will be in the middle to communicate between the two.
REST sets a standard for routes between the application (or client software program) and another application or server. The application is stateless which means it doesn’t need to store data or know anything about the other applications’ state. The only information they need to know will be in the request the client sends. They are also reusable in that they can take repeated requests and give reliable responses without one affecting another.
Also, with RESTful naming conventions there are 7 route names linked to 4 HTTP methods (GET, POST, PUT or PATCH, DELETE) that create a user-friendly URL path and have a set purpose.
Combine it all together, a RESTful API is an application program interface (API) that uses any or all of the 4 HTTP methods to request data from another application or server.
A RESTful API can also be referred to as a RESTful web service.
The most common forms of a RESTful API I’ve dealt with are something like The Open Movie Database (OMDb) API or something I’ve built with Ruby on Rails as an API.
Then, there will be specific endpoints with specific data:
http://www.omdbapi.com/?t=blade+runner
But, in order to access this data, the request that you send with 1 of the 4 HTTP methods needs an API key which will be a long string of alphanumeric and special characters.
That endpoint also aligns with the predictable and user-friendly RESTful concept of URL Paths. It follows a particular formula.
It’s all kind of coming together for me. RESTful API’s are everywhere and used everyday.