Editing APIs

Objective

After completing this lesson, you will be able to Edit APIs.

Edit an API

In this lesson, the following topics are discussed:

  • Explore the View API view.
  • Explore the Notification Area (No. 3).
  • Explore the API URL - Proxy URL (No. 1).
  • Explore the Navigation tabs (No. 2).
  • Create or edit an API from API Designer.

Explore the View API View

When you create and deploy an API, it is displayed in the API view. The following is the example of the GWSAMPLE_BASIC API.

The following areas are marked to be examined in more detail in the following list:

  • No. 1: API URL - Proxy URL.
  • No. 2: Navigation Tabs No. 3: Notification area.

Explore the Notification Area (No. 3)

On the right panel you will find the API Health, active calls made and related usage information about the API.

Since we have not yet used this API, there is also no usage information available.

API URL - Proxy URL (No. 1)

At No. 1, you can see the new URL (proxy URL) with which you can now call the original source API. The URL consists of the following elements:

Virtual Host

The virtual host was created during the provisioning of API management and can be changed at any time using SettingsAPIs.

API Host
Depends on your sub account. Can also be your own custom domain name.

Navigation Tabs (No. 2)

There are five tabs with the following names:

  • Overview
  • Proxy Endpoint
  • Target EndPoint
  • Resources
  • Revisions
Tab 1: Overview

In this Overview tab you will find all major information about your API.

These are as follows:

  • Title
  • Host Alias, that is the host from your Proxy URL on top of this page
  • API Base Path
  • API State (Active, Alpha, Beta, Deprecated, Decommissioned)
  • Description

On the bottom of the interface, there is a Product Associated area. Later we create a product based on our API. Every entry can be changed.

Tab 2: Proxy EndPoint

Here you can add some Proxy Endpoint Properties and Route Rules. Read more here: API Proxy Structure

Tab 3: Target EndPoint

Here you find the configured API Provider or the URL. In this case, we see the SAPGatewayDemoSystemES5_Provider. It is also possible to use Load Balancing.

Tab 4: Resources

This is the most important area of an API. It shows with a swagger UI all possible resource paths and REST actions ( GET, PUT,DELETE ..) with all necessary parameters.

The following figure gives us the example of a resource path, /ProductSet, the REST action GET with predefined query parameters.

Tab 5: Revisions

Where do these entries in this tab come from?

While creating APIs for SOAP and REST, API resources are not auto generated; you must add them manually. While creating the API for ODataAPI, auto generation of resources may be possible in some cases. This is the case if you use an API provider of type On-Premise with SAP back end or one from Type Open Connectors. The visualization of the resources is carried out by the swagger User Interface implementation. This interprets the openAPI spec of this API.

Create or Edit an API From the API Designer

Since it is not always possible to have the resources generated automatically, the SAP API Management* also offers you the ability to do this manually. The resources visualize the openAPI spec created in the API Designer.

Procedure for creating an API

In the Configure view of your APIs, choose the link, Create in API Designer to open the API Designer. You will find a simple start template in YAML.

You can now start to write your own openAPI spec. To edit an openAPI spec, you use the same editor. Of course, you can also use other editors, such as IDEs, Visual Code and others, and copy the result into it.

Summary

The proxy URL is the new URL in order to ultimately consume the resource API. The virtual host name can be defined by yourself. It will be used as API host (API Proxy Url) in the subaccount.

The proxy URL is the new URL in order to ultimately consume the resource API. The virtual host name can be defined by yourself. It will be used as API host (API Proxy Url) in the subaccount. There could also be a custom domain here. SAP API Management offers different tabs with different functionalities in the View View API. The Resources tab is the most important. The resources describe the REST functionalities ( GET, POST ..) and the paths to the actual data ( /ProductSet, /BusinessPartnerSet ..). The description is based on the openAPI specification. The visualization of the openAPI specification is carried out with the swagger UI. The swagger UI is an open source JavaScript framework to make APIs tangible.

Explore the API Designer

Business Scenario

Our objective is to utilize the openAPI format, which is a vendor-neutral description format, to define new APIs or modify existing ones. The component diagram below highlights the connection and artifacts that will be generated, indicated by the grey shading.

Task flow

In this exercise, you will perform the following tasks:

  1. Explore the API Designer - Design-First Approach.
  2. Explore the openAPI spec of your API GWSAMPLE_BASIC_v1.

Prerequisites

  • You have a working API Management.
  • You have a working API Provider.
  • You have a working API.

Outcome After This Exercise

Get familiar with the concept of using openAPI specification and the implementation with the API Designer.

What Do You Learn Within This Exercise

Get familiar with the concept of using openAPI specification and the implementation with the API Designer.

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.

Steps

  1. Explore the API Designer. A design-first approach.

    1. Navigate to ConfigureAPIs.

    2. Choose your GWSAMPLE_BASIC_v1 API.

    3. Choose the EditEdit in API Designer to open the API Designer.

    4. Check out the API Designer.

      • No. 1: Import openAPI spec in YAML or JSON
      • No. 2: Download openAPI spec in YAML or JSON
      • No. 3: Paste different formats (RAML, Data, JSON)
      • No. 4: Generate Server Stub generates an server Implementation ind different languages and Frameworks (Node.js, Java -Spring, Java EE)
    5. Choose every menu entry to check out how they work.

  2. Explore the openAPI spec of your API GWSAMPLE_BASIC_v1.

    1. The editor’s area describes the definition of the API in YAML (Yet Another Markup Language) format. More information can be found at https://yaml.org/

    2. OpenAPI is the standard for describing REST-based interfaces. More information can be found here: https://www.openapis.org/. We use the OpenAPI Specification 3.0.0 (1)

    3. There are several blocks within this API description. One is the API Server (2). This is the original source API of our ES5 system.

    4. Path blocks describes the resource context. Every resource context will be visualize with the Swagger UI (3). You can find more here: https://swagger.io/tools/swagger-ui/

Log in to track your progress & complete quizzes