When we need to connect two devices, we use some kind of interface, like a plug and socket pair or a guitar jack and a jack cable. The objects to be connected are of a different nature, but the interface allows us to "communicate" with each other.
Applications also need interfaces, Application Programming Interfaces, or APIs for short. Programming interfaces are used in areas ranging from online shopping to social networking, and play an important role in creating connections between applications and services.
APIs simplify the application development and integration process by allowing developers to use off-the-shelf solutions instead of having to create programming code to connect services every time. Some examples:
- With Google Maps API developers can create applications that use maps, routes, and other geodata, but don't have to worry directly about the maps themselves and the algorithms associated with them. Client applications can send queries to the Google Maps API and receive ready-to-use data about locations, distances and travel times between points on maps.
- Twitter API allows developers to access Twitter's data, including tweets, user profiles, and search results. This API is often used by social media monitoring tools, analytics platforms, and customer service applications.
- Stripe API provides a way for developers to accept online payments and manage transactions. This API is popular among e-commerce platforms, online marketplaces, and subscription-based services.
- Amazon Web Services API offers a suite of cloud computing services, including storage, compute, and database services. AWS API is used by businesses of all sizes to build and scale their applications and infrastructure in the cloud.
- OpenWeatherMap API provides weather data for any location in the world. This API is used by weather apps, travel apps, and transportation companies to provide users with up-to-date weather information.
Each of these APIs has its own unique features and capabilities, but they all share the common goal of simplifying the process of integrating services and building applications.
Several different kinds of APIs have been created for different tasks. Here are some of the most common protocols for organizing the interface:
- REST is the most popular type of API used for communication between client and server applications. For example, the Google Maps API described above uses the REST protocol.
- SOAP is an older protocol compared to REST and is used to exchange messages based on XML objects. SOAP API provides high reliability and security, but requires more resources for processing than REST API.
- GraphQL API allows clients to request only the data they need, i.e., it makes requests more flexible compared to REST. This reduces the amount of data transferred and speeds up service communication.
- RPC is a remote procedure call and function call protocol on a remote server. Google has developed a modern implementation of the protocol called gRPC. This variant uses the HTTP/2 protocol and is supported by many programming languages.
- Webhooks is a mechanism that allows applications to receive automated notifications about events in other applications.
As usual, each protocol has its advantages and disadvantages, and the choice of a particular protocol depends on the specific requirements of the project.
The idea of API hubs
Modern programs often interact not with a single API, but with many different interfaces.Creating all sorts of interfaces with different APIs turns into a routine task. API hubs come to the rescue.
An API hub is a platform that combines multiple APIs in one place and provides access to them through a single interface. Instead of integrating each API individually, developers can use a single API hub - it's like having one single interface to all the other interfaces.
In addition, API-hubs provide additional tools and features:
- API usage monitoring,
- automatic update,
- authentication, authorization and account management,
- categorical search and API comparison,
- using the development languages closest to the used technological stack,
- different levels of API and data access for different users.
Some of these functions are also implemented by special API management platforms, which we will talk about next. It is worth noting that some API hubs are implemented as marketplaces, where hundreds of paid and free APIs can be accessed as part of a single subscription — so platforms can pay for a subscription to paid APIs and support work with them. This is often more profitable than connecting to each paid API individually - rarely do we use the full amount of requests provided by a subscription.
In general, API hubs help reduce the time and cost of API integration, and facilitate the development process by allowing developers to build and test applications faster using the APIs provided.
Examples of API hubs
RapidAPI is a hub and marketplace with 10,000 APIs from different providers. The platform contains APIs for machine learning, finance, social media and other tasks. A simple interface for working with APIs with documentation, code examples, testing queries and monitoring usage. You can add your own solution to the marketplace as well.
The service has free and paid plans. The first provides limited access to API, paid plans have additional features such as SSL support and higher request processing speed
Postman is an API development tool that allows developers to test API, create requests, process responses, and debug their applications. The product's website has an integrations section, which is actually an API hub with 11,000 third-party API integrations.
API deck makes the API easier for professional programmers - just install the library for the desired language and you can access connectors to various APIs. The free package includes 2000 API queries.
The Apify platform is not a classic API hub, but it implements features that are useful extensions to API hubs. Apify is a platform for web scraping and web automation. It lets you create scripts to automate repetitive tasks, such as gathering information from web pages, processing it, and saving it to a database. Such scripts can be used to create bots for social networking, monitoring product prices, and collecting other data.
API management platforms
The main difference between API management platforms and API hubs is that API management platforms are designed to manage a company or organization's own APIs, while API hubs are designed to manage multiple APIs provided by different companies or organizations. However, these are often related things - a company can enrich data from other APIs and create a new quality of data in its own API, so it's worth briefly mentioning them here.
Apigee is an API management platform with a full set of tools: creating, managing, monitoring and protecting. Apigee provides support for multiple programming languages and platforms, including Java, Node.js, .NET and others. Apigee provides integration with Google Cloud, such as Google Kubernetes Engine and Google BigQuery. Kong also integrates with other products, but this ecosystem is less developed.
Kong is used by large companies to manage access to multiple APIs. Unlike Apigee, the platform has not only a paid enterprise version, but also a free open source version. The service allows you to create, scale and manage your own APIs, as well as provide high performance and reliability. Kong supports many protocols, including HTTP, HTTPS, WebSockets, TCP and gRPC, which allows for easy integration of various types of applications and services. At the same time, the company places great emphasis on API speed: up to 50K transactions per second for a single node. The system also has dozens of plugins for API service monitoring and analytics.
Tyk is another API manager with high performance and scalability, API access control with authorization and authentication rules, tools for monitoring and analysis.
MuleSoft is an application integration platform that includes an API hub, tools for creating, monitoring and managing APIs, and tools for application integration, including data and service management.
The choice of an API hub depends on many factors, such as the type of project, the complexity of API integration, the need for additional tools and functionality. Here are some recommendations on choosing an API-hub for different types of projects:
- Small project: If you are working on a project with a small number of APIs, the API hub with free access is good for you.
- Large project: If you are working on a large project with a large number of APIs and complex integration, you may need a paid API hub such as Apigee or AWS API Gateway. They provide a broader set of tools and functionality for API management and monitoring.
- High security requirements: If you need a high level of security for your project, you might consider an API hub such as Kong or Tyk. They provide additional authorization and authentication features, as well as protection against attacks.
- A project with a need for additional tools: If you need additional tools for API management, you might consider API hubs such as Postman or SwaggerHub. They provide additional functionality such as automatic documentation creation and API testing.
Literature on API technology and software interface design
- "APIs: A Strategy Guide" by Daniel Jacobson, Greg Brail, and Dan Woods
- "Building Microservices: Designing Fine-Grained Systems" by Sam Newman
- "RESTful Web Services" by Leonard Richardson and Sam Ruby
- "Web API Design: Crafting Interfaces that Developers Love" by Brian Mulloy
- "Implementing API Gateways using Ocelot in .NET Core" by Gaurav Kumar Arora