Gauge Newsletter September 2017 | Page 13

WHAT ARE API s ? H ave you ever wondered how an article from your favourite blog or news channel allows you to share it on Facebook, Twitter or LinkedIn with a click of a button embedded in the website itself? Well, it is all thanks to the concept of API. But is it a new thing? Of course not. But it might be a broader concept than you think. Hope this article will help you understand what this really m eans in everyday practice. The letters stand for ‘Application Programming Interface’. In simple terms, APIs could be identified as a piece of code that allows two or more stand-alone programs to communicate with each other. With the explosive growth in technology and mobile devices, customers/users expect more personalised services and information and most businesses already have adopted ‘custom- er-oriented marketing’. Therefore, a program will have to excel in every aspect. For an example, if your website provides informa- tion about the best restaurants close to you, (Eg. ‘Yelp’) you will have to show the places in an interactive map like ‘Google Maps’ or ‘Apple Maps’. So, instead of you coding and develop- ing a separate map, just to show the place markers, why not use those map services themselves? For your information, apps like ‘Yelp’ has done exactly that. The main take away is “Let them do what they do the best.” Simply put, this concept is more like meeting a doctor. If you get some disease condition, do you need to study biology and acquire a degree from a medical school to find the cure? You just need to meet a doctor (who already has the information you need) and get their service. When you need a capability in your program, you can get it as an API service from a program, just like that. LOCAL Local APIs are the original form from which the name came. They offer OS or middleware services to application pro- grams. Microsoft’s .NET APIs, the TAPI (Telephony API) for voice applications, and database access APIs are examples of the local API form. WEB-LIKE Web APIs are designed to represent widely used resources such as HTML pages and are accessed using a simple HTTP protocol. Any web URL activates a web API. Web APIs are often called REST (Representational State Transfer) or RESTful because the publisher of REST interfaces doesn’t save any data inter- nally, between requests. Hence, requests from many users can be intermingled as they would be on the internet. PROGRAM-LIKE Program APIs are based on remote pro- cedure call (RPC) technology that makes a remote program component appear to be local to the rest of the software. Service oriented architecture (SOA) APIs, such as Microsoft’s WS-series of APIs, are program APIs. HOW DO API S WORK? APIs work as an interaction between two elements. The first is a specification that describes how information is exchanged between programs, done in the form of a request for process- ing and a return of the necessary data. The second is a software interface written to match that specification and published in a user-friendly manner. The software that wants to access the features and capabilities of the API is said to ‘call’ it, and the software that creates the API is said to ‘publish’ it. A software requiring the service of an API would only want the results to be returned based on the given input data to the API. That is, developers don’t have to expose the complete under- lying code of the API. Instead, APIs do this by exposing some of the program’s internal functions to the outside world in a limited fashion, thereby not needing to dig up the source code of the API to get things done. TYPES OF APIS; According to ‘TechTarget’, APIs could be categorised into three different types, based on the application they are used in. Gauge Magazine University of Peradeniya 13