What is an API?

What is API in simple words?

An API is a set of independent functionalities of a certain program. The main purpose of an API is to allow other programmers use some components of an already developed software without impacting the software itself.

We may draw a parallel and look at the whole software development as English language. APIs here would be represented by the dictionaries, and they are the items where certain words are defined and exemplified. This way, a person who does not speak English, can still understand the meaning of the word, its application and this person can also try composing a sentence using the words he picked up from the dictionary.

Why API is important?

The main idea behind Application Program Interfaces is that they allow a faster and more reliable software development. Instead of fully establishing all of the features of your own application, with API you can fully focus on the core values of your code. You are enriching your code with the already developed software by simply connecting it to your application.

Easy examples of API usage

Let’s assume I am a developer that is currently working on the next best text editor. My main task is to deliver a powerful set of features and make sure that they work like a charm. However, every text editor requires a spellchecker, to make it truly useful for the end user. As I am a developer, not a linguist, it would be quite hard to accomplish this task in general and also pretty unresourceful to code a spellchecker from scratch. This is where I start looking for the components that might help, and I would want to find only the components that can be connected via API. Once I am able to find a decent spell checker with an API, by task is just to simply connect it to my text editor and this way I can save lots of time and efforts on coding.

API in spell checker

We can also look at another example, which is a little bit more complex. Imagine you are a German owner of an ecommerce site. What you want to focus on is the proper promotion of your shop, assurance of predictable revenues, availability of the right products and great customer satisfaction. However, the main challenge of the online shop is that you do need to supply the visitors with easy online payment options. One way to do it is by application of the screen scraping technologies, which may not always be legal. To do this, you would need to understand how the bank website functions and after this you can write a piece of code that lets your customers to perform wire transfers. This is possible only if you know how to code and the whole process may take months.

Besides that, once you have your own software written, it will be quite vulnerable to the changes. In other words, if the bank changes some of its transfer mechanics, your code would need some rework to function properly again. However, Germany is the country where an home banking API is provided. This way you can simply make a use of a single URL that allows a wire transfer. This way you can write just a tiny piece of code (or hire someone to do it) and it will do the job just great. First it would redirect a user to the payment system page, then it will allow a user to make a secured payment, followed by a confirmation of the payment. All of these happens fast and easy thanks to the API.

Features of a good API

It can be said that there is no universal rule that can separate good APIs from bad APIs, except for a quite logical one - if it works it is good, otherwise it is bad. This would rather depend on the nature of the task that API was designed to accomplish. However, I can highlight the following three features that make an API good.

A good API documentation

It goes without saying that a properly documented API is vital for any development. Of course API is not an exception, it should come together with clear guidelines to assure seamless integration.

Well tested 

Nobody wants to connect their application to something that is not stable, this is why testing is so important at APIs and generally in any piece of the software.

Encapsulation

A great API is the one that is not seen and felt by the end user of the software. In other words, if I am a visitor of the online shop and I want to pay for the goods in my basket, I should only focus on making a payment without knowing and seeing how the whole process of my payment is structured amongst the parties.

Main Advantages of APIs

With the help of APIs, programmers are able to use countless amount of components and this way it is truly possible to excel in the software developing. Among a great amount of the benefits, I can highlight the following ones:

Simplicity of programming

With APIs, programmers can leverage the development by implementing the software that was already developed by other people. This way a programmer can fully focus on the core values of his app.

Separation of concerns

API is an ultimate way of connecting programs and services. In the past, to produce a functional piece of code, an ecommerce platform for example, you would need to have a separate team for each of the features that a platform should have. You would need to get a team that builds a whole shopping UI, another team that makes your platform connected with the payment systems and so on. This would of course result in high costs. Even though the structuring of the process remains the same today, the productivity of your software developers is increasing with the growing availability of diverse APIs. Today your main concern is to build a your program and connect to it the missing components via APIs.

Ease of access

Another amazing thing about APIs is that they make a lot of great enhancements and features easily accessible. 

You may actually may not be aware - but you are benefiting from an API at this very moment. As you are reading this article at your browser, the browser gets the symbols through an API, and this way it can display you this great article. Benefiting most of the APIs is of course not often so simple, often it takes time to understand the API and then to implement the client.

API advantages

To illustrate the main advantages of an API, let’s look at a process that all of us can easily imagine - building a house. How would you build a house? Well, probably you would start with a master plan, land purchase and then you would head to the store to grab some materials. Same way you would start developing a software, you begin with specification / task description, then get some infrastructure and start with the development. 

api as constructing

The main question is, would you prepare all of the construction materials on your own or would you get ready-made solutions? Of course you would be able to design a little bit more suitable door out of raw wood, but it would certainly take much more time, efforts and would also require you to be skilled enough to do it or hire someone for that. The thing is, same applies for coding. There is no need to develop everything from scratch, when you can use a piece of code that has been tested and used before by hundreds of developers. This way you can simply achieve better and faster results.

What is the future of API?

Making predictions is often hard, yet not when it comes to APIs. I am unable to tell the exact t results driven by the API, but what I can say is that APIs will be able to deliver anything that is possible to imagine, and even a little more beyond that. Now there are tourists travelling in submarines, watching the fish through google glass and having the wikipedia data about this fish displayed. What would the future of API bring us? Hard to tell, but I can certainly stress that APIs are here to make our lives easier, comfortable and certainly more exciting and productive.

by Maciej Danecki


Like our special posts? Get them directly at your email every week.