Describing Application Programming Interfaces (APIs)

Objectives

After completing this lesson, you will be able to:

  • Describe APIs and their needs.
  • Identify the benefits of APIs.
  • Analyze the anatomy of APIs.

Business Introduction to APIs

You may face some challenges when transforming your business to an intelligent, sustainable enterprise. For example, you need to integrate applications and business processes in a diverse landscape of cloud-based or hybrid-based systems. You also have solutions from non-SAP suppliers, in which case, you need to integrate from SAP to non-SAP processes. You can use the SAP Integration Suite to integrate SAP to SAP processes, and non-SAP to SAP. Your company can also commercialize and manage your APIs through the SAP Integration Suite.

APIs Overview

API is an acronym for "Application Programming Interface". It is the mediator (represented by a piece of software) between applications/websites and you as a user. Therefore, it is vital for communication between different instances to exchange information.

Visualization of the API process.

You encounter APIs in everyday life without you realizing it. An example is Google Search: Every time you enter something into the search bar, Google's back-end service looks up your keywords in its database and lists your request's results on the website. Actually, the website displays the API's result. An indicator for this is the URL of the respective search.

When thinking of a search for "SAP", the URL states: www.google.com/search?q=sap.

Now let us slice this one down:

Here www.google.com is the server address, /search indicates the feature you intend to use, or better, the API you want to call, which in this case is the Google Search API, and q (for query) tells it that now a value for query is handed over, which is the search term.

The same applies to SAP's help page (https://help.sap.com). When entering API into the search bar, the following URL comes up: https://help.sap.com/docs/search?q=api.

However, an API call doesn't necessarily have to be initiated by a computer. Voice assistance systems are also an example of the integration and use of APIs. Asking your voice assistant to search for something actually provides the assistant with your query. This query is then stored as text and added as the query to the API call. Afterward, the assistant gives out the API’s result via audio voice.

So, no matter what you do with any of your connected devices, you are using several APIs per hour without noticing. This is why APIs are such an important topic, because they are omnipresent and enable users and developers to focus on "what" needs to be done and not "how". Also, have you ever thought about how your WhatsApp message gets sent to a recipient?

Therefore, as the name suggests, an API is just one of many types of interfaces used to trigger specific functions, for example, playing music. You might already be familiar with other types of interfaces, such as GUI (Graphical User Interface), which we use to navigate across applications/websites with the help of a mouse/touchscreen.

Benefits of APIs

The Need for APIs

APIs are indispensable for IT architectures nowadays. Although access from front-ends to back-ends, interface management, and point-to-point communication have been substantial parts of IT architectures for years, APIs have revolutionized how applications and websites communicate. Therefore, APIs have brought many benefits to building and managing IT landscapes. The most important ones, and therefore key reasons why companies need to implement them in their IT architecture, can be summarized as follows:

List of the benefits of the APIs

APIs, at their core, separate communication from the task. Thus, if a service communicates through an API, the user (or consumer) of the API is entirely focused on the features the API provides. The user only uses the API’s features without thinking about the job itself. The focus is based on the request and the result (response) and nothing else.

Anatomy of APIs

API Types

For defining and implementing APIs, different global standards are available for use. A few of these are listed below (however, the most commonly used are REST APIs):

Common API Types

With REST APIs as the most popular API type, we will briefly dig a little deeper into REST APIs functions. When working with APIs, you usually speak of resources. This means that typically you either want to:

  • Create something (like adding a new entry to a guest book).
  • Read or get something from the API (remember your Google Search: here you tried to get a list of websites).
  • Update or change something (usually when you have created something which needs to be changed, like the status of something or if you made a typo).
  • Delete something.

Together these actions are abbreviated as: CRUD.

For REST APIs these verbs are very similar to the CRUD verbs:

Comparison Between CRUD and REST Verbs

CRUDREST
READGET
CREATEPOST
UPDATEPUT / PATCH
DELETEDELETE

You may notice that "update" has two possible verbs: PUT & PATCH.

Patch only changes a part of the resource you are referring to. Think of your guest book entry, where you correct one word only and would inform the guest book that word number 42 needs to be swapped. This would be a patch - a spot on repair or change. PUT, on the other hand, would be changing the whole text, even if it is mostly the same, but with the error corrected (think of clearing the whole text and pasting everything in again).

Usually, when looking at an API's specification, these verbs are displayed as illustrated below (retrieved from an example deployment on the SAP BTP Integration Suite). An API does not necessarily support all verbs.

API Verbs

Key Takeaways Of This Lesson

Application Programming Interfaces (APIs) enable you to communicate and exchange data with an application. By using APIs human effort can be reduced, costs can be saved, and system integration can be driven much faster than before. There are a few different types for defining and implementing an API but the most common one will be the REST API.

Log in to track your progress & complete quizzes