If you are new to tech, you might be confused by a term that you’ll see all over the place: API. Let’s take a look at what it means, some examples, and how you can use it.
Definition
API is the abbreviation for application programming interface. Those words alone probably don't help much, so let’s see what each of them means here.
Application
Applications are programs that provide some feature(s) to users. They store and retrieve data, perform calculations, etc. Applications give us a reason to use computers at all. The direct usefulness of applications contrasts with programs that we run to access other programs, for example:
- we use the operating system to open applications, and
- we use browsers to access web applications.
Interface
The interface is an exposed part of an application, prepared to receive input from the outside. As a user, you maybe already be familiar with some types of interfaces:
- graphical user interface (GUI)—the most common interface that we all know from personal computers and mobile devices.
- command line interface (CLI)—where the user types a program name and parameters to run a program.
Programming
An API is an interface that is meant to be used by other programs. So, instead of exposing buttons or menus, the application provides a way of interacting with it in a machine-friendly way. Nowadays, it is typically understood as a Web API—an online server that exposes different routes and returns data in a format that is both easy to parse for a computer and understandable for humans.
The name itself doesn’t imply any specific channel of communication—there are other types of APIs as well. On the web platform, we have an ever-growing list of APIs exposed to JavaScript by the browsers. The way of accessing differs, but the method is almost always rather rigid and requires precise interaction with it.
Intuition
APIs are simply a way for applications to communicate with each other. Good APIs are stable—because a breaking change in one application will require an update in all applications that use it. And good APIs are documented—because otherwise it’s very difficult to write a program that uses them.
Examples
Let’s take a look at some examples of APIs that you could play around with.
URL
The URL (uniform resource locator) is a form of an API. As users, we usually use them without thinking much about them. We use a web browser to fetch and display a website from an address that we clicked as a link. With well-designed addresses, we can tweak them and get still get a response from the server:
- when we replace the
Netherlands
part of https://en.wikipedia.org/wiki/Netherlands withBelgium
, we get a valid URL: https://en.wikipedia.org/wiki/Belgium - Some URLs are organized in a nice hierarchy. If we remove parts of https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Numbers_and_dates, we go up to:
- A list of JavaScript guides,
- general JavaScript page,
- Main page.
A well-designed URL system invites us to tweak the address but will not help much if we ask for a page it doesn’t have. For example, when we replace JavaScript
with TypeScript
, we get https://developer.mozilla.org/en-US/docs/Web/TypeScript:
Playing around with URLs can be a simple way of trying out communicating directly with a machine—and getting used to their requirements of providing the parameters in exactly the way they expect.
Command line programs
Another simple way of starting with APIs are command line programs. Similarly to web APIs, the first step is to read the documentation. Then, make a few trial and error attempts at getting the program to do what you want it to do. In another article, I provide a simple introduction to CLI programs.
Web API
As a tester or a programmer, you are most likely to use a web API. They are relatively easy to use, but there are some difficulties involved:
- the access can be limited to authorized users—each system will have a different way of authorization and can require creating a user, logging in, providing the session information in cookies or some ID and key pair
- without getting too deep, you can do only GET requests—by pasting the API address into the address bar of your browser. The other types of requests (POST or DELETE) will require either getting some specialized program or writing simple JavaScript in the developer tools of your browser.
Let’s see some examples of APIs that you could experiment with:
What you can do with APIs
The main use of an API is to call other applications from the program you write. You can use them to leverage other systems for any variety of functionalities:
- OAuth for authorization with 3rd-party providers such as Google for Facebook
- getting automated translations from the cloud
- getting geolocation from map systems
- automatically cross-publishing the same content on many social media platforms
- accessing large language models to provide some AI functionality
- and many more
In a way, a lot of modern programming is writing glue code between different APIs.
How understanding APIs helps you debug
Because so much programming is about calling APIs, there is a lot of troubleshooting that can be done there. Many bugs I created encountered in my frontend programming career were caused by either
- sending an incorrect request to the API, or
- interpreting the response incorrectly.
If the frontend sends a valid request and displays the response as it should, then the bug is probably on the backend. If you can troubleshoot that much as a tester, this can significantly speed up finding and fixing the bug.
Learn more
If you are interested in learning more about APIs, programming, and testing, sign up here for an occasional email from me.
Top comments (7)
An Application Programming Interface (API) serves as a vital conduit in the digital realm, facilitating seamless communication and interaction between different software applications. For those just stepping into the world of technology, deciphering its significance might seem daunting, but let's demystify it.
At its core, an API stands for an application programming interface. While the term might appear cryptic initially, breaking it down reveals its essence. An "application" refers to software programs that deliver specific functionalities, be it storing data, performing calculations, or offering services. Think of them as the tools that enable us to leverage the capabilities of computers. An "interface," on the other hand, denotes the exposed part of an application primed to receive external input. Whether it's the graphical user interfaces (GUIs) we navigate on our computers or the command line interfaces (CLIs) where commands are typed, interfaces are the gateways through which we interact with applications.
In the realm of programming, an API serves as a standardized interface designed for inter-program communication. Unlike conventional user interfaces, APIs cater to machine-to-machine interactions, offering a structured means of accessing and manipulating data or services. Today, the term "Web API" predominantly refers to online servers that furnish endpoints through which data can be retrieved and actions performed. While Web APIs are ubiquitous, other forms of APIs exist, each tailored to specific contexts and technologies.
Understanding APIs is akin to deciphering the language through which applications converse. Just as clear communication fosters collaboration among individuals, well-designed APIs facilitate interoperability between software components. Stability and documentation emerge as hallmarks of a robust API, ensuring compatibility and ease of integration across diverse applications.
To grasp the concept better, let's explore some tangible examples. URLs, or uniform resource locators, embody a form of API that we routinely interact with while browsing the web. Every time we click on a link, our web browser employs URLs to fetch and display the corresponding web pages, underscoring the pervasive role of APIs in our digital interactions.
Transform your blank walls into captivating showcases with Paolomodena's exquisite artworks. Our collection offers a range of stunning pieces, from vibrant paintings to intricate sculptures, perfect for adding life and personality to your space. Blank walls need artworks Whether you seek a bold statement or subtle elegance, Paolomodena's artistry brings beauty and inspiration to every corner. Let your walls come alive with the timeless allure of Paolomodena's masterpieces.
The title tag serves as an HTML element responsible for outlining a web page's title. When displayed in search engine results, it functions as the clickable headline for a particular entry. Ensuring a distinct and descriptive title tag is of utmost importance, as it ensures alignment between the tag and the page's content, enhancing its searchability and relevance.
Robotics: Robotics involves the design, construction, [Technology](techzone-agency.com/ and operation of robots that can perform tasks autonomously or semi-autonomously.
Biotechnology: Biotechnology applies biological processes and organisms to develop new
WOW,
that was a detailed guide on apis,thanks friend for providing this,codenewbie community is definitely awesome just like this one : theglobesimregistration.ph/
The title tag is an HTML element that defines the title of a web page. It is displayed in search engine results as the clickable On Page headline for a given result. It's essential to have a unique and descriptive title tag that accurately reflects the content of the page.
Some comments have been hidden by the post's author - find out more