Do you remember when booking flights, hotels, and travel activities would involve a marathon of phone calls and emails to compare prices? Or when you needed to create and memorize separate logins and passwords for each new website or application? Not so long ago, applications used to be completely disconnected, incapable of sharing information with each other. That was the world without APIs.
In this interview with Andrii Kovalov, our Python Engineer, we will talk about the transformative phenomenon of APIs, explore the biggest advantages and challenges of using APIs, and share insights on how to select the right API for your projects.
What is an API and how does it work?
An API, or Application Programming Interface, is a set of rules and protocols that define how applications interact and exchange data. This term has a broad meaning and encompasses various types and technologies.
To better understand the meaning of API, we can break the term down into its components and look at it in reverse: Interface defines the means of interaction, Programming refers to the type of interaction, and Application represents the software involved in the interaction.
Simply put, just as we use the user interface (UI) to interact with software, an API serves as a mediator enabling applications to interact with each other programmatically. However, instead of menus, tabs, and buttons, an API defines methods, protocols, and data formats that developers can use to make apps communicate with each other.
What are the biggest advantages of using APIs when building applications?
Understanding who and how will use an application is fundamental in any development process. If the software you design has to primarily interact with other applications without direct user involvement, building a well-documented, clear, and easy-to-use API is extremely important, especially when precision and clarity are top priorities. A well-designed API will allow other developers to effortlessly integrate your application’s functionalities into their creations.
When it comes to using external APIs in your application, the major advantage is the ability to access the logic and functionality of other systems or services. For instance, by making a single HTTP request to OpenAI’s APIs, we can use the LLM to generate text completion. This is far more efficient than running the logic locally, which would require substantial resources and make it impractical for many applications.
What challenges do developers face when working with APIs?
As with any other technology, working with APIs is a double-edged sword. They bring tremendous opportunities for enhancing the functionality of applications, yet there might also be potential difficulties to overcome:
-
Poor documentation. Unclear, inconsistent documentation or its absence is perhaps one of the most common issues. Without proper documentation, you can spend hours deciphering endpoints, parameters, and request/response formats, which results in a slow development process and increases the likelihood of errors.
-
Complexity. The ease of use of an API plays a very important role in its adoption. The lack of consistency in design, naming conventions, parameter formats, or overly complicated authentication processes can add unnecessary complexity to the overall development process.
-
Lack of concrete, deterministic results. Developers rely on APIs to provide deterministic results, expecting that the same input should always produce the same output. Unpredictable behavior and inconsistent results of API responses can often lead to errors and bugs, which disrupt application functionality and user experience.
Can you share some examples of how you’ve leveraged an API in recent projects?
Recently, we used an API in a project focused on generating document summaries using Large Language Models (LLMs). LLMs are a good fit for this task due to their advanced natural language processing capabilities.
However, running LLMs locally can be challenging, costly, and resource-intensive, especially when dealing with large volumes of text. Additionally, local LLMs may have lower performance based on benchmarks.
Therefore, we decided to use a paid API that offers completions by LLMs. One of the key factors that influenced our decision was its documentation quality and ease of use. The API documentation provided clear and comprehensive instructions on how to integrate and interact with the API, making the implementation process smooth and straightforward. On top of that, the API’s intuitiveness and robust error-handling mechanisms made it easy to handle edge cases and unexpected behaviors effectively.
Overall, implementing this API allowed us to incorporate advanced document summarization capabilities into our application quickly, minimizing development time and resource investment.
What criteria do you consider most important when selecting the right APIs for projects?
I believe there are several main criteria to consider:
-
Value and benefits. The most important factor is the value that the external API can bring to the project. Whether it’s accessing price information for goods, weather forecasts, LLM completions, or specific data processing capabilities, the API has to offer tangible benefits that are essential for achieving our project goals.
-
Ease of use. The ease of use is another critical factor to take into account. An intuitive API with detailed documentation can significantly streamline the development process and reduce the possibility of implementation challenges.
-
Availability. Only consistent API availability can ensure uninterrupted access to essential functionalities. Before implementation, it is important to assess the API provider’s uptime, service level agreements (SLAs), and historical performance metrics to minimize the risk of disruptions.
-
Performance. Depending on the project requirements, it is also essential to consider the performance characteristics of the API to ensure that it meets your expectations. The selected API should be capable of handling anticipated usage patterns and scale gracefully as the application grows.
What role do you believe APIs will play in the future of application development?
In my opinion, APIs have a really promising future. There’s already a wide variety of API types, covering different needs - from basic data retrieval to advanced machine learning. With more and more people learning to code and new tools being released all the time, the demand for APIs is only going to keep increasing. As long as we’re building apps, APIs will remain an essential element that connects software and services, providing users with seamless and personalized experiences.
Wrapping up
Applications are no longer isolated. Whether it’s connecting with third-party platforms or streamlining internal processes, APIs open new opportunities and create value that was previously unattainable. As this technology advances, we can expect to see even more innovative uses for APIs, changing our understanding of how apps interact with each other.