Undergoing a First Approach With an API

Objectives

After completing this lesson, you will be able to:

  • Describe concepts and basic elements of an API, first approach
  • Create an account on the SAP Gateway demo system (ES5)

APIs, a First Approach

In this lesson, the following topics are discussed:

  • What is an API First Approach?
  • What are APIs?
  • Types of APIs.
  • Interface types mainly used in SAP.
  • How to design APIs with description languages.
  • Fulfill the contract between API Provider and API Consumer.

What is an API First Approach?

The API First Approach is an approach to software design that focuses on the API to create applications that can be easily connected to each other. API First creates ecosystems of applications that are modular, reusable, and extensible, such as Lego bricks.

An API First Approach means that your APIs are treated as first class citizens. Everything revolves around the end product being used by mobile devices and client applications. An API First approach involves developing APIs that are consistent and reusable. This is achieved by using an API description language.

Explanation:

API Provider
An API provider provides an interface with technical features (No. 1). Symbolically, this is shown in this picture with the ball- or lollipop notation. This interface can be consumed by a service (No. 5). The representation corresponds to the socket notation (No. 2). The service acts in the role of the API consumer.
API Consumer
The API Consumer requires an interface (No. 3). The representation corresponds to the socket notation (No. 4). In this case, the API provider is the service (No. 5). The presentation is again made with the ball- or lollipop notation.

Find more information at:

What are APIs ?

API stands for Application Programming Interface. An API specifies the operations as well as inputs and outputs of a software component. It defines functionalities that are independent of their respective implementations, so that these implementations can vary without affecting the user of the API.

Types of APIs

In the literature, there are many overviews of different types of APIs. Below is a simple overview of the APIs that we need to understand for this course.

Here, four different APIs are defined under the superset of APIs, based on their use.

Databased APIs
These are intended for file exchange between systems. Files can be, for example, configuration files.
Object-orientated APIs
These are used in object-oriented programming languages to define the communication of the classes with each other.
Remote APIs (No. 1)
This includes today's important web APIS, such as REST and SOAP APIs. REST itself is not a protocol but a software architectural style.
Messaging APIs (No. 2)

These are mainly asynchronous APIs that send events based on events. These are used in Event Driven architectures.

In this tutorial, we will deal with the following APIs.

Interface types mainly used in SAP

Technically, a few protocols have been agreed upon. The following overview shows the APIs with their relationship to each other.

These are at SAP:

  • REST APIs, like RESTful HTTP APIs:
    • OData 2.0
    • OData 4.0, both like SAP Graph.
  • Remote APIs, like SOAP APIs.
  • Messaging APIs, like Event APIs.

The presentation formats are either JSON or XML.

How to design APIs with description languages

SOAP based APIs are described with Web Services Description Language (WSDL). It is an XML-based interface description language that is used for describing the functionality offered by a web service.

You will find more information about WSDL here: Web Services Description Language

REST-based APIs can be created with the following main description languages:

  • OpenAPI
  • RAML
RAML

RAML is a YAML-based language for describing RESTful APIs.

You will find more information about RAML here: https://raml.org/

OpenAPI

The OpenAPI Specification, previously known as the Swagger Specification, is a specification for a machine-readable interface definition language for describing, producing, consuming and visualizing RESTful web services.

You will find more information about OpenAPI here: openapis.org

The OpenAPI specification is used in API management.

Fulfill the contract between API Provider and API Consumer

The description in RAML or OpenAPI is the contract between API Provider and API Consumer. The API must be implemented along this contract. Two cases are possible:

Implementation - first approach
The implementation is first created on the part of the API provider. The description (contract) is then generated automatically. This is used by the Consumer API.
Contract - first approach

The API description is first created with RAML or OpenAPI. Generators automatically create the rudimentary implementation for the API provider and -consumer. These rudimentary implementations in different programming languages and concepts must then be fully implemented.

Summary

In an API First Approach, only the provided APIs are of interest. By using standardized communication protocols and concepts, such as REST and OData, almost any use case can be mapped across all borders. Communication takes place between an API provider who has the interface available and the API consumer who consumes this interface. The APIs are described with standardized description languages, such as RAML or OpenAPI. The implementation can be created at first at the API provider and then at the description (implementation - first approach based on it) or the other way round by first creating the description and then automatically creating server and client stubs from it (Contract - first approach). We see that SOAP APIs, OData 2.0 and 4.0 APIs as well as SAP Graph play the leading role in the SAP universe.

Create an Account on the SAP Gateway Demo System (ES5)

Business Scenario

The SAP Gateway Demo System is based on SAP NetWeaver AS ABAP 7.51. It is used, for example, to try OData Services. Various sample services are implemented for this purpose. This services are accessible via internet. In this exercise, the GWSAMPLE_BASIC service is used. This sample service is based on the Enterprise Procurement Model (EPM).

Task Flow

In this exercise, you will perform the following tasks:

  1. Create a new SAP Gateway Demo System Access.
  2. Go to SAP Gateway SAP GUI for HTML.
  3. Change the password.
  4. Open SAP Easy Access Menu for EPM: Classic Dynpro For Product Data.

Find out a tutorial: Create an Account on the SAP Gateway Demo System | Tutorials for SAP Developers

Prerequisites

  • A browser and internet access.
  • You need an SAP account. You created one in the last Task.
  • The description is for those who do not yet have a free account on the SAP Gateway Demo System (ES5).

Outcome After This Exercise

A working account in the SAP Gateway Demo System (ES5) with which you can consume OData APIs based on the EPM SalesOrder model.

What do you Learn Within This Exercise

You will learn how to create a free account in the SAP Gateway Demo System (ES5).

Exercise Options

To carry out this exercise, you can choose from the following options:

  1. Live Environment: Using the instructions provided below, you can perform the steps in your SAP BTP account.
  2. Platform Simulation: Follow the step-by-step instructions within the simulation.
  3. Side-by-side: Follow the step-by-step instructions within the simulation and perform the steps in your SAP BTP account simultaneously.
Note
We strongly recommend to perform the steps in the live environment.

Task 1: Create a new SAP Gateway Demo Access

Steps

  1. Create a new SAP Gateway Demo System Access.

    1. Open a fresh chrome browser window.

    2. Go to https://register.sapdevcenter.com/SUPSignForms/

    3. Enter your S-User or SAP ID User / E-Mail to register.

    4. Your registered SAP ID Service account will retrieve your user details.

    5. Check the I have read and understood the Terms and Conditions box.

    6. Choose the Register button.

    7. You will receive a success message for your registration via E-Mail.

    8. Do not close this successful registration step page.

    9. On that page, select Show password and note it.

      ________________________________________________

    10. Go to https://sapes5.sapdevcenter.com and logon with your credentials.

    11. Change your logon credentials as forced.

    12. Congratulations you have successful registered on the ES5 Gateway System.

Task 2: Open SAP Easy Access Menu for EPM: Classic Dynpro For Product Data

Steps

  1. Go to SAP Easy Access page.

    1. Open https://sapes5.sapdevcenter.com/sap/bc/gui/sap/its/webgui# and log on with your user and password.

    2. Open SAP Easy Access Menu forEPM: Classic Dynpro For Product Data.

    3. Choose the menu entry EPM: Classic Dynpro For Product Data

    4. Enter HT-1000 as productID and choose the Display button.

    5. You will find out the following product details:

      We use this function to check whether the product IDs we use later are also present in order to verify the processing.

Log in to track your progress & complete quizzes