What is an API and how do developers use it??

Contents

API defined as application program interface

Es probable que haya visto surgir el término “API”. Operating system updates, web browser and applications often announce new APIs to developers. But, What is an API and how do developers use it?

What is an application programming interface?

The term API is an acronym and means “Interfaz de programación de aplicaciones”.

Think of an API as a menu in a restaurant. The menu provides a list of dishes you can order, along with a description of each dish. When you specify which menu items you want, the restaurant kitchen does the work and provides you with some finished dishes. You don't know exactly how the restaurant prepares that food, and it really is not necessary.

Similarly, an API lists a bunch of operations that developers can use, along with a description of what they do. The developer does not necessarily need to know how, as an example, un sistema operativo crea y presenta un cuadro de diálogo “Save as”. They just need to know that it is enabled to use in their application.

This is not a perfect metaphor, since developers may have to supply their own data to the API to get the results, so maybe it's more like a fancy restaurant where you can provide some of your own ingredients that the kitchen will work with.

But it is quite accurate. APIs enable developers to save time by leveraging a platform implementation to do essential work. This helps reduce the amount of code developers need to create and also helps create more consistency between applications for the same platform.. APIs can control access to hardware and software resources.

APIs make life easier for developers

Let's say you want to develop an iPhone application. Apple's iOS operating system provides a host of API—Like any other operating system — to make this easier for you.

If you want to embed a web browser to display one or more web pages, as an example, you don't have to program your own web browser from scratch just for your application. You use the WKWebView API for embedding a WebKit browser object (Safari) in your application.

If you want to capture photos or videos from iPhone camera, you don't have to write your own camera interface. Use the Camera API to embed the iPhone's built-in camera in your app. If APIs didn't exist to facilitate this, application developers would have to create their own camera software and interpret the inputs from the camera hardware. But the developers of Apple's operating system have done all this hard work so that developers can use the camera API to insert a camera and then continue with the construction of their application.. AND, when Apple improves the camera API, all applications that depend on it will take advantage of this improvement automatically.

This applies to all platforms. As an example, Do you want to create a dialog box in windows? There is an API for that. Want to support fingerprint authentication on Android? There is an API for that, what's more, so you don't have to test each Android manufacturer's fingerprint sensor. Developers don't have to reinvent the wheel over and over again.

APIs control access to resources

APIs are also used to control access to hardware devices and software functions that an application does not necessarily have permission to use.. This is why APIs often play an important role in security..

As an example, if at any time you have visited a web portal and have seen a message in your browser indicating that the web portal requests to see your precise location, that web portal is trying to use the geolocation API in your web browser. Web browsers expose APIs like this to make it easier for web developers to access your location; solo pueden preguntar¿dónde estás?” y el navegador hace el trabajo duro de entrar al GPS o redes Wi-Fi cercanas para hallar su ubicación física.

The Google Maps website requesting location permission

Despite this, browsers also expose this information through an API because it is feasible to control access to it. When a web portal wants to enter your exact physical location, the only way to get it is through the location API. AND, when a web portal tries to use it, you, the user, you can choose to allow or reject this request. The only way to access hardware resources such as the GPS sensor is through the API, so the browser can control access to hardware and limit what applications can do.

This same principle is used in modern mobile operating systems such as iOS and Android., where mobile apps have permissions that can be enforced by controlling access to APIs. As an example, if a developer tries to enter the camera through the camera API, you can deny the permission request and the app has no way to get into your device's camera.

File systems that use permissions, as they do in windows, Mac y Linux, have those permissions imposed by the filesystem API. A typical application does not have direct access to the raw physical hard drive. Instead, the application must enter the files through an API.

APIs are used for communication between services

APIs are also used for all kinds of other reasons. As an example, if at any time you have seen a Google Maps object embedded in a web portal, that web portal is using the Google Maps API to embed that map. Google exposes API like this to web developers, which can later use the APIs to place complex objects directly on their web portal. If there were no API like this, developers might have to create their own maps and provide their own map data just to put a small interactive map on a web portal.

AND, because it is an API, Google can control access to Google Maps on third-party websites, making sure they use it consistently rather than messily trying to embed a frame displaying the Google Maps web portal, as an example.

This applies to many different online services. There are APIs to request the translation of text from Google Translate, or embed Facebook comments or Twitter tweets in a web portal.

The OAuth standard also establishes a series of APIs that allow you to log into a web portal with another service, as an example, use their Facebook accounts, Google or Twitter to log into a new web portal without creating a new user account for that site only. . APIs are standard contracts that define how developers communicate with a service and the type of output those developers should expect to receive..


If you have overcome this, you will have a better idea of ​​what an API is. As a last resort, you don't need to know what an API is unless you are a developer. But, if you see that a software platform or service has added new APIs for various hardware or services, it should be easier for developers to take advantage of those features.

Subscribe to our Newsletter

We will not send you SPAM mail. We hate it as much as you.