What is an API?
So firstly, what is an API? A lot of people have been asking this question recently due to the boom in web-based services. To start with it’s worth knowing that the term API is actually an acronym and it stands for Application Programming Interface and they are not anything new in software but with the huge growth in web developments have become a very popular way of splitting up applications or services.
One of the best metaphors for an API I have ever seen was to think about a plug socket. Here in the UK, we have a three-pin socket, you could think of the socket as being the interface to the service, electricity, that is needed to power all of our electrical products. If I was to head over Europe the service, electricity, still exists however the interface is not directly compatible as in Europe they use a different style socket.
API’s in software are most commonly seen as a web application interface now days, often a REST API, however it does not have to be an interface that is used over the web to be an API, they also exist within most non web applications.
Why use API’s?
API’s while not always needed, even in the web world, allow the interfacing of applications in a defined manor is a huge benefit. This allows internal and external teams to be able to communicate, often forming a spider’s web of links to build an overall solution.
The benefit is often seen the most within the web world however has benefits in all software development. Teams are able to split up things like development, maintenance and in fact the full lifecycles of projects allowing, for example, multiple independent teams to exist while working towards the same goal. This is often seen when developing a web application, you may have teams split into front end development, these people would be consumers of the API’s and backend development, these people would be producing the API’s.
Why are API’s now so popular?
The web has fueled the growth of API’s and even created an API economy. It would almost seem crazy to not use API’s when developing web applications. Companies have even been developed only providing services that are accessible via API’s, requiring other developers to build these services into the applications they are developing.
REST API’s or RESTful API’s are now one of the most common API types, due to this web application boom. REST is so popular as this architecture is so common and well known, meaning that REST based API’s are often quick for a developer to integrate with, usually using common libraries across multiple projects. REST stands for REpresentational State Transfer and was created by Roy Fielding, an American computer scientist and one of the principal authors of the HTTP specification.
REST is not a protocol or a standard but actually an architectural constraint, meaning that developers can implement the API’s in a number of different ways, optimizing for speed or data size.
When a REST request is made by a client the representation of state of the resource is transferred to the endpoint in a number of different formats. JSON format is generally the most popular format used due to the fact it is the most language agnostic while retaining readability.
Categories: Developer Chat