What Is an API: Concept and Architecture Types Explained on Real-Life Examples

138 Views
|
19 Nov 2020
|
13 min
author avatar
Oleksandr Sh.
Technical writer

Software development has numerous terminologies and complex concepts. API is the one that goes hand in hand with engineers during their work. This concept is something that a lot of near-technical people have heard of, but don’t understand its meaning.

So, what’s an API? Let’s imagine a typical conversation between two people. While talking we use verbal language and non-verbal signals to exchange the information and express our feelings. When surfing on the Internet, your device and websites you visit also need a communication channel. APIs act as a communication channel between your computer and the server.

Companies use APIs for internal tasks and commercial needs, while individual developers create multifunctional APIs for enthusiasts. In this post, you’ll get an in-depth understanding of what is an API, different types of APIs, and their structure.

Table of contents

What’s an API?

First of all, let’s figure out what an API stands for. The API stands for application programming interface. It serves as a data transmitter between two different pieces of software.

What's an API?

The concept of API

APIs consist of two main components:

  • Specification. Technical specifications that describe data exchange details. They determine how the data will be retrieved.
  • Interface. Interface ensures the communication between two applications. REST, API, RPC are the most popular API interfaces.

You can think of APIs as a contract. This contract determines how users can connect to the software and includes the following:

  • Type of operations users can perform
  • Type of input data
  • Type of output data

How APIs Work?

Even though the word "interface" comes last in the definition of an API, it's not less important. Basically, the interface ensures seamless communication between users and the system. Let’s imagine that the car is a software product. It’s a complex system with many functions. However, it’s primary aim is to get users from point A to point B.

The wheel and pedals will be your API in the car. With their help, you don’t need to know all internal processes that happen inside the car. You simply turn your wheel and push the pedals. With their help, the car understands when it needs to accelerate, slow down, and turn. This interface is unified, so when you know how to drive your car, you can easily drive other cars.

So, what does API mean in software development? APIs help developers to extend their project’s functionality. They don’t need to build features from scratch. Instead, engineers use APIs from trusted vendors to reuse features that have already been developed by someone else. This approach lets them accelerate the development process and cut the expenses.

Types of APIs

High prevalence of APIs in software development has led to their division into different types and architectures. Engineers can choose the interface from a wide range of structures depending on their goals and technical requirements.

First things first, let’s discover how developers can access different types of APIs.

By Availability

Open APIs

Public APIs, or better known as open APIs, are available to every developer. Open APIs are shared for free on the Internet, so that other applications could access them.

Even though public and open APIs seem similar, the purpose of APIs is slightly different. With open APIs publishers provide their solutions freely with complete access to the architecture and all features. Public APIs usually have more restrictions in terms of access to the structure. With public APIs, publishers have more influence on the security and management of their own software.

Due to the free access, it’s hard for organizations to control who uses their APIs and what APIs are used for. That’s why companies should apply serious measures to prevent possible cyberattacks and ensure the safety of their customers.

Still, taking into account all drawbacks, open APIs may be a great way for startups to promote themselves. Having created useful APIs, young companies may encourage developers to use their software and create innovative products. Both startups and developers benefit from the API.

Well-known open APIs

Open APIs provided by famous companies

Let’s consider what API means for companies:

  • Cost-efficiency and reduced development time
  • With APIs, developers are free to use their favorite tools
  • API publishers can expand their user base without additional expenses
  • The publisher keeps the rights for the source code

What are API’s drawbacks? We can highlight the following points:

  • An open API is a user-oriented piece of software. That’s why all software updates, bug fixes, and security issues should be taken with the utmost seriousness. All flaws and gaps lead to poor user experience and possible damage to brand loyalty.
  • Open APIs tie developers’ hands. Sometimes companies that create APIs decide to change the terms of use or add a fee for their software. In this case, developers have nothing to do but accept the terms or redesign the architecture for another API.

Today, both startups and large companies provide open APIs to attract more users to their software and increase customer loyalty. One of the most common use cases for open APIs is social networks.

For example, Twitter is a perfect example showing what is the purpose of an API for large companies. Twitter API granted programmatic access for software development enthusiasts that had an idea of how to improve the social network. The popular platform TwitPic, which allowed users to seamlessly upload photos to Twitter, was based on the Twitter API. Another example is TweetDeck that displays users’ timelines, mentions, messages, hashtags in a single interface.

Even though the API has made many services possible, Twitter decided to shut down the access to the API, arguing that the social network was flooded with unnecessary solutions. Developers felt betrayed by Twitter because they invested their time and effort into Twitter’s success.

What is an API used for Twitter today? Twitter has recently introduced the new Twitter API v2. Engineers have drawn up new requirements and policies for independent teams, so the platform won’t make the same mistake again.

Internal APIs

Internal APIs are the exact opposite to open APIs. Internal APIs are used by in-house developers to achieve company goals.

Basically, internal APIs have the same definition of an application programming interface. It ensures communication between software products. However, the source code can’t be accessed by third-party developers. With the help of internal APIs, in-house developers create enterprise-level solutions like CRM systems, ERP software, HRS solutions, and more.

The top concern for any business is data privacy. Sending data to external resources creates a number of security risks. What is APIs’ role in cybersecurity? They grant data integrity during the data exchange between different departments in the company.

On top of that, internal APIs give more flexibility in terms of enterprise software because they’re originally created for in-house projects. In plain language, developers don’t need to adjust the API for third-party solutions created by other developers. They know exactly how in-house software works, and can update the API without putting workability of some features at risk.

Almost every company that uses internal software builds APIs for their enterprise products. Internal APIs let software developers reuse code more effectively and make following projects more agile.

Adobe is a great example of a company that relies on internal APIs. The company published many products, and internal APIs are the most important communication channel between these applications. Besides, Adobe also provides open APIs for third-party developers that need custom plugins for different products (Lightroom). You may check Adobe documentation to see what APIs are used for in their products.

Partner APIs

A partner API is a form of open API, but with one exception. Access to the API is granted under certain conditions determined by the publisher.

What are the APIs’ benefits for businesses? Publishers use this type of API to monetize their products. Developers can use the API on a subscription basis or after a one-time payment. Partner APIs often come with gateways that grant access after the payment and restrict access once the subscription expires. This revenue model is common to software as a service (SaaS) model.

However, not all publishers distribute the product on a paid basis. Sometimes, it’s enough to be the publisher’s eligible partner to access the API. For example, the company can get a license from a bank to make financial transactions on its platform through the partner API. Publishers can also request detailed information about the purpose of the API in the project. If they decide that the product looks suspicious, they may decline the access request.

A well-known example of a partner API is eBay Developers Program. Authorized developers can interact with various databases via eBay API. What is the API’s role within this platform? Engineers can easily integrate code to their platform to get valuable information about purchased and sold goods, provide feedback about other customers, browse available products, and more. The membership is free, but eBay obliges specialists to create a developer’s account.

?

Learn how much does an e-commerce website cost (a detailed estimate of each feature included).

Composite APIs

Composite APIs can make a request to different endpoints in a single call. This approach is meant to boost performance and speed up the execution process. This type doesn’t have a unified distribution model. Different vendors set their own requirements for accessing the API.

Salesforce, a SaaS CRM solution, provides composite APIs to simplify the integration with clients’ software. The company grants access to the API once users pay for the subscription. It’s important to remember that composite APIs are the most complicated type of APIs, so you should find experienced developers to create a trustworthy interface. Salesforce provides detailed documentation and paid consultations to master their software.

By Structure

Apart from availability, APIs also differ in architecture. There are different kinds of APIs that have their own use cases and specificities.

This section covers the most popular API architectures and explains their benefits and pitfalls.

JSON-RPC and XML-RPC

RPC or remote procedure call is a protocol for data transmission in JSON or XML format. The RPC protocol’s characteristic feature is support for batch operations. It means that RPC-based APIs can execute several operations during a single call. So, what does this API mean in computer terms?

RPC architecture example

RPC architecture

Let’s imagine that you have a social media website. To set up a user profile, you have to create a user instance, set up their avatar, and select their range of interests. RPC lets you make a single request with all of these operations, while other protocols create an individual call for each operation. So, the purpose of the API is to reduce the number of repetitive operations.

RPC protocol provides client- and server-side libraries for all popular programming languages. Even if RPC doesn’t support the language you’re using, it doesn’t take much time to implement the protocol manually. Besides, RPC is a real protocol, unlike REST, which is an architectural style. Protocols have standardized requirements without so-called “best possible practices” that may be interpreted differently and lead to disagreements inside the development team.

Finally, RPC protocol shows the best performance in small and mid-sized in-house and enterprise-level solutions.

However, the RPC protocol has some shortcomings compared to other types of API. If you need to cache the data from the response, RPC protocol requires additional manipulations with local storage. This leads to redundant architectural modifications and poor performance.

RPC interaction with a load balancer

RPC and a load balancer

Additionally, this protocol forces developers to keep more data about user sessions on the server. This fact makes these APIs harder to scale and test for malfunctions.

To sum up, if you’re not aiming at a high-load web project, RPC protocol is a great option. It can accelerate the development speed and improve minor systems’ performance.

REST

REST stands for representational state transfer. It’s a software architectural style that provides a set of recommendations for web development. REST is a definition of the API’s architectural middle ground.

REST structure meets the primary requirement of all stateless processes. An app with a stateless architecture depends only on third-party storages and doesn’t keep any data on its physical disc. All data the app needs should be present in the request.

Stateless architecture is the best choice for software that’s designed to perform well under heavy loads. REST structure allocates the workload correctly with the help of load balancers. Simply put, a platform processing millions of requests every minute won’t cease to operate and will keep the minimal possible network latency.

REST architecture

REST and a load balancer

Caching is a default operation included in REST APIs. What is the API’s impact on architectural integrity? With REST APIs, developers can work with native architecture without making any manipulations, which can lead to malfunctions.

What are REST APIs’ downsides? One of them is implementation difficulties. The reason for it is that REST doesn’t have a unified standard. It’s a concept with a lot of recommendations. Such freedom leaves a lot of room for developers’ creativity, which sometimes can harm the project. Engineers often can’t find common ground in terms of realization. Disagreements may slow down the planning phase.

On top of that, the REST structure isn’t suitable for small projects. It doesn’t support batch operations, so it’s better to stick with RPC in such cases.

The REST model has a higher entry threshold for developers. So, keep in mind that you’ll need several experienced web developers in your team to create a balance API with the REST structure.

SOAP

SOAP or Simple Object Access Protocol is a definition of API protocols and standards chain. In terms of processing speed, SOAP causes the highest pressure on the system.

SOAP architecture example

SOAP architecture scheme

The difference between the SOAP and REST architecture is that REST uses HTTP protocol for caching, scaling, and other processes. With SOAP architecture, developers have to look for alternatives to HTTP protocol, which are often least effective. In turn, SOAP can work with any other data transferring protocol. In reality, this benefit is highly questionable. HTTP is an all-in-one tool for API development, and other transferring protocols don’t have the same potential.

Moreover, the SOAP architecture returns responses exclusively in XML format. When making a web service call with JavaScript, it’s definitely better to get a response in JSON, which is a native Javascript file format. XML format requires developers to make data transformation operations, which affect the performance and may lead to incorrect outputs.

However, it’d be unfair not to mention that the purpose of API with SOAP architecture is to process operations. Unlike REST, which works with resources, SOAP handles far more sophisticated tasks.

If you have a simple blog and you need editing features like create, edit, and delete articles, it’s reasonable to use REST architecture. The HTTP protocol reduces development time and improves performance. Performance is the main factor that API stands for.

On the contrary, the API that includes multiple verifications in real-time and processes financial transactions should be built with SOAP architecture. The protocol includes a number of features that improve security and boost the speed of complex operations.

?

In this post, we’ve explained how to comply with PCI DSS requirements and protect your users’ sensitive data.

To sum up, it’s impossible to name the best structure for the API. Everything depends on your project requirements and specifications. To choose the best option for your project, you should clearly define your goals and get consulted with experienced web developers.

How Can Cleveroad Help You?

At Cleveroad, we know what API development is. We have experience in building and integrating APIs that gets the work done. Our software engineers have an in-depth knowledge of all up-to-date architectures and protocols. We’ve built more than 170 successful projects and worked with APIs from well-known vendors like Stripe, Twilio, Braintree, Facebook, and more.

Get the job done
Our software engineers will consult you on protocols and API integration or development. It’s free of charge.

Frequently Asked Questions

Rate this article!
An image
An image
An image
An image
An image
(22 ratings, average: 4.53 out of 5)
Leave a comment
An image
Your message is checked by the moderator and
will add to the site ASAP
Latest articles
Article preview image
Disclosing How to Make a Business Plan for a Startup
Calendar icon
26 Nov 2020
Clock icon
15 min
Article preview image
How to choose between IT outsourcing models
Calendar icon
24 Nov 2020
Clock icon
13 min
Article preview image
Guide to managing offshore development team
Calendar icon
17 Nov 2020
Clock icon
9 min
typos
Report a typo
Back to top