API Layer : Why? How? What?

Sikandar
3 min readMar 5, 2018

--

Application Programming Interface is used as a lingua franca of modern communication between various apps

Computer science education today puts a lot of emphasis on algorithms and data structures, with less focus on the principles behind designing programming languages and frameworks. This leaves application programmers unprepared for an increasingly important task: the creation of reusable components. Designing application programmer interfaces, APIs, is hard. It is an art as difficult as designing programming languages.

Before the rise of object-oriented languages, reusable generic code was mostly written by library vendors rather than by application developers.

The ‘P’ in API stands for “Programmer”, not “Program”, to highlight the fact that APIs are used by programmers, who are humans.

The API layer is used to shield the outside world or your clients from knowing the structure, organization, or even what exact service.

Reference: Lynda.com

An API layer(software library) is nothing more than an aggregated proxy of all of your service offerings. Graphic user interfaces provides user interaction, and behind it API handles actions in abstraction mode. For example, your Email client. Soon after writing draft, the moment when you are about to send; APIs will have an information about this SEND request from you and will do abstract operations such as validation sender mail id, attachment etc,.

In other layman words, API layer is a bridge between your client and application. Bridge which carries data from/to application/client. With this mechanism, will have consistent security along with data transfer.

Simple video which explains about API concepts?

An API is to the programmer what a GUI is to the end-user
=> Try this below mentioned URL in your browser.

Ref: Youtube video screenshot API in JSON response

APIs provide a unified way to open up information assets and share it easily. Nowadays API developers prefer one of two formats to perform data exchange — XML/JSON or even both of them. All the built-in properties for validation in XML and JSON’s agility made both formats firmly fixed in the leadership position in the API world.

However, parsing and validating an XML file can take a large amount of memory. Moreover, the addition of tags and variety of attributes will lend to extra weight. As a result this can affect the performance of apps in some environments like mobile ones.

In contradiction to XML, JSON is based on Javascript object data that is shared between applications. These objects allow data to be available to the rest of the code that runs in the system. JSON is simpler and lighter in usage, making it a favored data exchange format.

No application wants to public expose their database queries, as it costs security vulnerabilities predominantly. Hence forth, for having access to organisation’s application developers will be writing API Layer. This gives other clients to use organisation’s application.

Ex: Demonstrates API layer and its communication with client

In summary, Application developers will be designing this API layer. So clients (including web, android, iOS etc,.) need to get communicate with Application via API layer.

While designing API layer, developers should consider,
APIs should be minimal and complete, have clear and simple semantics, be intuitive, be easy to memorize, and lead to readable code.

APIs need quality assurance. The first revision is never right; you must test it. Make use cases by looking at code which uses this API and verify that the code is readable.

Happy exploration.

--

--

Sikandar
Sikandar

Written by Sikandar

Technical Product & Strategy

No responses yet