API Management and Api's
API Management and Api's
What is an API:
Definition, Types,
Specifications,
Documentation?
How does human communication happen? People can express thoughts, needs,
and ideas through language (written and spoken), gestures, or facial expressions,
right? At the same time, our interaction with computers, apps, and websites requires
user interface (UI) components – a screen with a menu and graphical elements, a
keyboard, and a mouse.
Software or its elements, on the other hand, don’t need a graphical user interface to
talk to each other. To communicate and exchange data and functionalities, programs
use machine-readable interfaces called APIs.
If you ever read tech magazines or blogs, you’ve probably seen the abbreviation
API. It sounds solid, but what does it stand for? API stands for Application
Programming Interface. This post will explain what APIs are, how they work, and
why you should care about them in the first place.
What is an API?
An API is a set of programming code that enables data transmission between one
software product and another. It also contains the terms of this data exchange.
1. POST: Used to create a new resource on the server. When you send a POST
request to an API endpoint, it typically means you're adding something new to the
server.
2. GET: Used to retrieve data from the server. When you send a GET request to an
API endpoint, you're asking the server to provide you with data, which is usually
read-only and doesn't modify the server's state.
3. PATCH: Used to partially update a resource on the server. It allows you to make
changes to specific parts of a resource without replacing it entirely.
4. PUT: Used to update a resource on the server. When you send a PUT request to
an API endpoint, you're typically replacing the existing resource with the new one
provided in the request. It's used for full updates.
5. DELETE: Used to request the removal of a resource from the server. When you
send a DELETE request to an API endpoint, you're asking the server to delete the
specified resource.
The Red Hat specialists note that APIs are sometimes considered contracts, where
documentation is an agreement between the parties, “If party 1 sends a remote
request structured a particular way, this is how party 2 software will respond.”
API components
Application programming interfaces consist of two components:
As for now, we’ll focus on what types of APIs exist, their use cases, and who each
type is suitable for.
Types of APIs
There are different types of APIs that can be categorized based on the ways they are
available for use and according to their initial design purposes.
Partner APIs. This type of API is openly promoted but shared with business partners
who have signed an agreement with the publisher. The common use case for partner
APIs is software integration between two parties. A company that provides partners
with access to data or capability benefits from extra revenue streams. At the same
time, it can monitor how the exposed digital assets are used, ensure whether third-
party solutions using their APIs provide decent user experience, and maintain
corporate identity in their apps.
Public APIs. Also known as developer-facing or external, these APIs are available
for any third-party developers. A public API program allows for increasing brand
awareness and receiving an additional source of income when properly executed.
There are two types of public APIs – open (free of charge) and commercial ones.
Open public APIs, as the Open API Definition suggests, are those with all
features public and available for use without restrictive terms and conditions.
For instance, it’s possible to build an application that utilizes the API without
explicit approval from the API supplier or mandatory licensing fees. The
definition also states that the API description and any related documentation
must be openly available. On top of that, these APIs can be freely used to
create and test applications.
Commercial API users pay subscription fees or use APIs on a pay-as-you-go
basis. A popular approach among publishers is to offer free trials, so users
can evaluate APIs before purchasing subscriptions. Learn more about how
businesses benefit from opening their APIs for public use in our detailed
article on the API economy.
Availability is only one criterion on which APIs are classified. Let’s look at them from
a different angle.
Another example is ORDS database API, which is embedded in Oracle REST Data
Services.
Operating systems APIs. This group of APIs defines how applications use the
resources and services of operating systems. Every OS has its set of APIs, for
instance, Windows API or Linux API (kernel user-space API and kernel internal API).
Apple provides API references for macOS and iOS in its developer documentation.
APIs for building applications for Apple’s macOS desktop operating system are
included in the Cocoa set of developer tools. Those building apps for the iOS mobile
operating system use Cocoa Touch – a modified version of Cocoa.
Remote APIs. Remote APIs define standards of interaction for applications running
on different machines. In other words, one software product accesses resources
located outside the device that requests them, which explains the name. Since two
remotely located applications are connected over a communications network,
particularly the internet, most remote APIs are written based on web standards. Java
Database Connectivity API and Java Remote Method Invocation API are two
examples of remote application programming interfaces.
Web APIs. This API class is the most common. Web APIs provide machine-readable
data and functionality transfer between web-based systems which represent client-
server architecture. These APIs mainly deliver requests from web applications and
responses from servers using Hypertext Transfer Protocol (HTTP).
Developers can use web APIs to extend the functionality of their apps or sites. For
instance, the Pinterest API comes with tools for adding users’ Pinterest data like
boards or Pins to a website. Google Maps API enables the addition of a map with an
organization’s location.
Most businesses use more than one API to connect applications and share
information. Some end up needing an API management tool to help them control,
distribute, and analyze different APIs. Learn more about API management in our
detailed article.
API specifications/protocols
The goal of API specifications is to standardize data exchange between web
services. In this case, standardization means the ability of diverse systems, written in
different programming languages and/or running on different OSs, or using different
technologies, to seamlessly communicate with each other.
RPC is also known as a subroutine or function call. One of two ways to implement a
remote procedure call is SOAP.
Extensible markup language (XML) is a simple and very flexible text format widely
used for data storage and exchange over the internet or other networks. XML
defines a set of rules for encoding documents in a format that both humans and
machines can read. The markup language is a collection of symbols that can be
placed in the text to delineate and label the parts of the text document. XML text
documents contain self-descriptive tags of data objects, which makes them easily
readable.
SOAP is mostly used with enterprise web-based software to ensure the high security
of transmitted data. SOAP APIs are preferred among providers of payment
gateways, identity management, and CRM solutions, as well as financial and
telecommunication services. PayPal’s public API is one of the commonly known
SOAP APIs. It’s also frequently used for legacy system support.
RESTful systems support messaging in different formats, such as plain text, HTML,
YAML, XML, and JSON, while SOAP only allows XML. The ability to support multiple
formats for storing and exchanging data is one of the reasons REST is a prevailing
choice for building public APIs these days.
Social media giants and travel companies provide external APIs to improve their
brand visibility even more. Twitter has numerous RESTful APIs; Expedia has both
SOAP and RESTful APIs for its partners. If you consider redefining your travel and
hospitality business offering, dive deep into the world of travel and booking APIs with
our dedicated article.
JavaScript Object Notation (JSON) is a lightweight and easy-to-parse text format for
data exchange. Its syntax is based on a subset of the Standard ECMA-262 3rd
Edition. Each JSON file contains collections of name/value pairs and ordered lists of
values. Since these are universal data structures, the format can be used with any
programming language.
A GET request for restaurant details with a response in JSON. Source: OpenTable
gRPC
gRPC is an open-source universal API framework that is also classified under RPC.
Unlike SOAP, gRPC is much newer and was released publicly in 2015 by Google.
With gRPC, the client application can directly call methods from a server application
located on a different computer as if it was a local object. This makes it easier to
create distributed services and applications.
Like SOAP and REST, the transport layer for gRPC is HTTP. However, similar to
RCP, gRPC allows developers to define any kind of function calls, rather than
selecting from predefined options such as PUT and GET in the case of REST.
By default, gRPC uses protocol buffers instead of JSON or XML as the Interface
Definition Language (IDL) for serializing structured data. Here, the developer needs
to first define the structure of the data they want to serialize. Once the data
structures have been specified, they use the protocol buffer compiler to generate the
data access classes in the programming language of your choice. The data is then
compressed and serialized in binary format at runtime. Learn more about gRPC in
our detailed article.
GraphQL
The need for faster feature development, more efficient data loading due to
increased mobile adoption, and a multitude of clients, made the developers look for
other approaches to software architecture. GraphQL, initially created by Facebook in
2012 for internal use, is the new REST with organizations like Shopify, Yelp, GitHub,
Coursera, and The New York Times, using it to build APIs.
GraphQL is a query language for APIs. It allows the client to detail the exact data it
needs and simplifies data aggregation from multiple sources, so the developer can
use one API call to request all needed data. Another special feature of GraphQL is
that it uses a type system to describe data.
Using types to describe data allows apps to specify what data they need to get
Apps using GraphQL control what data they need to fetch from a server, which
allows them to run fast even when the mobile connection is slow. You can see
how GraphQL, REST, RPC, and SOAP are compared in the linked article.
API documentation
No matter how many opportunities for creating or extending software products API
gives, it would remain an unusable piece of code if developers didn’t understand how
to work with it. Well-written and structured API documentation that explains how to
effectively use and integrate an API in an easy-to-comprehend manner will make a
developer happy and eager to recommend the API to peers.
The API documentation is a reference manual with all the needed information about
the API, including functions, classes, return types, and arguments.
Documentation may be static and interactive. The latter allows you to try out APIs
and see return results. It usually consists of two columns: human and machine. The
human column contains API descriptions, and the machine column has a console to
make calls and contains info that clients and servers will be interested in
when testing the API.
Human and machine columns in the documentation Code examples on the machine
column (right) after a user clicked for an action (“Get all employees”). Source: AMIS
Examples of APIs
Here are some examples of well-known APIs that use different protocols and
specifications. Check their documentation to get more information and references.
Google Maps. It is no secret that Google is among the tech giants, and they have
set the standards in the way other companies operate. Most websites that have an
integrated map are using the Google Maps APIs. For example, Google’s Directions
API uses an HTTP request to return XML or JSON-formatted directions between
geolocations.
Vulkan. Vulkan is a cross-platform API that works on the operating system level. It
enables developers to create high-quality, real-time graphics in applications and
drives the communication between an application and a graphical processing unit.
Check Vulkan API documentation if you’re interested.
WeatherAPI. This is a free geolocation and weather information provider with lots of
different APIs ranging from the weather forecast, IP lookup, sports, astronomy,
geolocation, and time zone. It provides access to geodata and weather using a
JSON/XML RESTful API. Developers can use either HTTP or HTTPS to request the
API. They provide developers with detailed documentation on how to use all of their
APIs.
Sabre Air Availability. This is a Sabre SOAP API used to search for flights and the
corresponding availability information for given dates, origins, and destinations.
Since it is a SOAP API, it uses XML as the data exchange format, and HTTP or
HTTPS protocols for requests.
Yelp API. This is a GraphQL API that provides users with recommendations and
reviews of the best restaurants, things to do, nightlife, and more. It uses the HTTP
request method to access data from the servers. The API connects to data sources
through endpoints, which developers can add to their apps. It uses JSON as the data
exchange format.
Whatever the case, specialists don’t have to deal with source code, trying to
understand how the other solution works. They simply connect their software to
another one. In other words, APIs serve as an abstraction layer between two
systems, hiding the complexity and working details of the latter.
The role of APIs is even greater if we look at it not only from the software
development angle but also from the business collaboration angle. These machine-
readable interfaces for resource exchange are like delivery services that work under
the hood and enable that needed technological connectivity. According to the
Fourth State of API Integration Report of 2020, 83 percent of participants find API
integration “critical” to their businesses and IT infrastructures.
In this regard, the two main tasks for decision-makers and developers are to select
the API that works for a company’s specific business needs and understand how to
effectively use it.
We can divide Web APIs into groups by intended level of access and scope
of use. There are four widely agreed-upon web APIs: open APIs, partner
APIs, internal APIs, and composite APIs.
Open APIs
Open APIs, also known as public APIs or external APIs, are available to
any developer. As a result, open APIs typically have relatively low
authentication and authorization measures and are often restricted in the
assets they share. While some open APIs are free, others require a
subscription fee, which is often tiered based on the number of calls made to
the API.
There are several advantages to making APIs public, the biggest being the
ability to share data openly. This encourages any external business or
developer to integrate with the app that owns the API, making both the
third-party software and the API more valuable. Because of the lack of
restrictions and easy implementation allowed by the open API, third parties
can quickly leverage the data it provides.
For example, the traffic app Waze uses public APIs provided by
municipalities and other partners about road closures, accidents,
construction delays, and service vehicles. In turn, Waze makes cities easier
to navigate, which pleases residents and attracts more visitors.
Partner APIs
Partner APIs are shared externally, but only among those with a business
relationship with the API company. Access is limited to authorized clients
with official licenses, and thus security measures tend to be stronger with
partner APIs than with public APIs.
Some businesses favor partner APIs because they want (1) greater control
over who can access their resources and (2) more say in how those
resources are used. For example, Pinterest adopted a submission-based
approach to providing access to new data services via its API, requiring
partners to submit a request detailing how they would like to use the API
before being granted access.
Internal APIs
Unlike open APIs and partner APIs, internal APIs (also called private APIs)
are not intended for use by third parties. Internal APIs are only made
available for use inside a company and are meant to streamline data
transfers between teams and systems. Developers working for the
company can use these APIs, but external developers can’t.
Composite APIs
Because they reduce the number of total API calls, composite APIs can
result in less server load and overall faster systems, as well as reduced
complexity in the system. They’re commonly deployed in microservices in
which one job may require data from many internal APIs to complete.
Take this example from Stoplight: Say you want to create an order within a
shopping cart API. You might think that this takes just one request. But, in
fact, several requests must be made. First, you need to create a customer
profile. Then, you need to create the order, add an item, add another, and
change the status of the order. Instead of making five separate API calls in
succession, you can make just one with a composite API.
REST
Today, the majority of web APIs are built on REST. REST, which stands for
representational state transfer, is a set of guidelines for scalable,
lightweight, and easy-to-use APIs. A REST API (or “RESTful” API) is an
API that follows REST guidelines and is used for transferring data from a
server to a requesting client.
For a more in-depth look at REST guidelines, see our full guide to REST
APIs. Briefly, these guidelines are:
Client-Server Separation: All client-server interactions must be in the form of a
request from the client, followed by a response from the server. Servers can’t
request and clients can’t respond.
Uniform Interface: All requests and responses must use HTTP as the
communication protocol and be formatted in a specific way to ensure compatibility
between any client and any server. Server responses are formatted in JavaScript
Object Notation (JSON).
Stateless: Each client-server interaction is independent of every other interaction.
The server stores no data from client requests and remembers nothing from past
interactions.
Layered system: Requests and responses must always be formatted the same way,
even when passed through intermediate servers between the client and the API.
Cacheable: Server responses should indicate whether a provided resource can be
cached by the client and for how long.
By following these guidelines, REST APIs can be used for quick, easy,
secure data transfers, making them a popular choice among developers.
SOAP
SOAP (Simple Object Access Protocol) is a protocol for transmitting data
across networks and can be used to build APIs. SOAP is standardized by
the World Wide Web Consortium (W3C) and utilizes XML to encode
information.
SOAP strictly defines how messages should be sent and what must be
included in them. This makes SOAP APIs more secure than REST APIs,
although the rigid guidelines also make them more code-heavy and harder
to implement in general.
For this reason, SOAP is often implemented for internal data transfers that
require high security, and the more flexible REST architecture is deployed
more commonly everywhere else. But, one more advantage to SOAP is
that it works over any communication protocol (not just HTTP, as is the
case with REST).
RPC
RPC APIs may employ either JSON (a JSON-RPC protocol) or XML (an
XML-RPC protocol) in their calls. XML is more secure and more
accommodating than JSON, but these two protocols are otherwise similar.
Though the RPC protocol is strict, it's a relatively simple and easy way to
execute code on remote networks.
RPC APIs are limited in their security and capabilities, so you likely won’t
see them as often as REST or SOAP APIs on the web. However, it can be
used for internal systems for making basic process requests, especially
many at once.
If you’re not someone who needs to know the gritty-gritty, this is a good
baseline understanding of the types of APIs out there and how developers
use them. By harnessing the right API, you’ll empower your business to
partner with other applications, expanding your reach and influence.
Metering
Application Programming Interfaces are generally published to
support specific business needs. This may be for making certain
features available to your partners or publishing information on an
e-commerce site that you don't want to share with everyone (e.g.,
what products customers buy). Metering is the process of tracking
API usage and then charging back clients accordingly based on the
number of calls made against each endpoint.
Workflow Management
This provides a way to connect your API with other services and
APIs, allowing you to orchestrate processes. For example, an
amazon seller or e-commerce site may want its partners to use
specific webhooks or make calls against certain endpoints to fulfill
orders. Workflow management tools allow you the flexibility of
creating multiple use cases or custom workflows that meet your
business needs while maintaining control over which features are
available at each stage of this process.
Gateway
This is where clients receive requests and are routed through an
authentication service for verification before being passed on to
backend services, which then return their response to the client via
the Gateway. The Gateway can also be used as a proxy or reverse-
proxy server, allowing it to receive data from multiple external
sources simultaneously.
Authentication Service
Responsible for verifying credentials such as username and
passwords supplied by users attempting to connect with APIs
published within API Management. Authorization Services
determine whether those users have permission (based on rules
defined in policies) and what level of access they should be granted
(based on their user roles).
Policies
These are rules that control who has access to which APIs. They
ensure the right users have the correct level of access and
determine what resources a given client can see or do, such as
create/read/update/delete operations against an endpoint.
Tags
Each API published within API Management is assigned tags, so it
becomes easier to filter or limit requests (throttling) by type when
examining usage reports, allowing companies to identify trends in
demand quickly.
Monitoring Service
Provides accurate information on how your APIs are being used.
This includes metrics such as the number of calls per second, the
geographical location from which requests are coming in, and the
most popular endpoints.
Businesses looking for more control over their entire platform will
likely be interested in using both solutions together because they
provide complementary functionality, which makes them ideal
partners when building out any new product line with multiple APIs.
Increased Agility
To remain competitive, companies need to respond to customer
demand quickly. Doing so can best be achieved by leveraging
existing services to improve the customer's experience.
APIs represent the reusable services that companies can use to
connect systems within or external to their organization. Using
these reusable services is a quicker approach to software
development. One that improves time to market for extra features or
innovations.
Security
While APIs are convenient, they can present a security risk if not
managed properly. This is especially true as the integration catalog
grows. Managing these resources helps keep track of these assets
to ensure they follow proper security protocols to prevent data loss
or a breach.
Create
The create phase is the start of the lifecycle. It is during this stage
where the integration is modeled and ultimately created. It is also at
this stage where data needed to support the API is integrated.
Lastly, documentation is created at this stage.
Control
The control phase is where deployment happens. The deployment
process pushes the integration to the target audience. It is also
during the stage where controls are set to determine who can
access the integration and how.
Consume
It is during the consumption phase where the integration is
published so that developers can find and use the service. During
this phase, it is important to define how the integration will be
discovered.
Design
The design tool allows developers to define requirements and
model their integrations. It also enables them to create, publish, and
deploy their integrations.
Gateway
As the number of integration points increase, companies need to
monitor and control traffic. The gateway acts as a filter that sits
between the client and services on the backend. It allows
developers to configure security, performance, and availability
standards for the catalog.
Developer Portal
Also known as an API portal, this tool enables companies to publish
their integrations to be discovered and consumed by others.
Lifecycle Management
This tool helps developers maintain integrations throughout each
stage of the development and deployment processes. It helps
ensure consistent processes for each integration.
Analytics
Analytics is a valuable component because it provides insight into
how the integration is performing and how they are delivering value.
This information helps leaders identify areas for improvement.