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 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 graphic shows the GWSAMPLE_BASIC API in the API view.

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 find the API Health, active calls made, and related usage information about the API.

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

The graphic shows the API Health, calls made, and related usage information about the API.

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:

  • API URL: https://group-cld900-d052537.prod01.apimanagement.eu10.hana.ondemand.com:443/GWSAMPLE_BASIC
  • Application protocol: https
  • Virtual Host: group-cld900-d052537
  • API Host: prod01.apimanagement.eu10.hana.ondemand.com
  • API Port: 443
  • API Name: GWSAMPLE_BASIC
Virtual Host

The virtual host was created during the provisioning of API management and can be changed at any time using SettingsAPIs. Check and see your Host Alias name.

Choose Settings > APIs.
API Host
Depends on your subaccount. It 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
Screenshot of the five tabs: Overview, Proxy Endpoint, Target EndPoint, Resources, and Revisions. Information about the tabs are provided in the next paragraph.
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
The graphic shows the Overview tab.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
The graphic shows the Target EndPoint tab.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 the 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, and the REST action GET with predefined query parameters.

The graphic shows the example of a resource path.

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 can be possible in some cases. This is the case if you use an API provider of type On-Premise with SAP backend or one from Type Open Connectors. The visualization of the resources is carried out by the Swagger UI implementation. It interprets the openAPI spec of this API.

Tab 5: Revisions

With API revisions, you can make incremental changes to an API proxy without disrupting the deployed API. You can access previous changes made to the API proxy and even restore the API to any of its earlier states.

Revisions typically consist of small, incremental, and compatible changes, such as adding a property, a new resource, or a policy to an API proxy. Revisions are created when changes do not disrupt existing consumption flows. They are independent of the actual URL used for consuming the API. Because the deployed revision is the one being consumed, there is no need to access it separately. The API proxy URL remains consistent across different revisions.

Only one revision of an API proxy exists in the runtime environment. In the design phase, you can view and compare the contents of different revisions.

For more information on creating API Revisions, visit the help.sap.com website: Creating API Revisions | SAP Help Portal

The graphic shows an overview of the Revision.

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 it 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.

Screenshot of the procedure for creating an API as previously described.

You can now start to write your own openAPI spec. To edit an openAPI spec, you use the same editor. 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 to ultimately consume the resource API. The virtual host name is defined by you. It is used as an API host (API proxy URL) in the subaccount.

The proxy URL is the new URL to ultimately consume the resource API. The virtual host name is defined by you. It is used as an API host (API proxy URL) in the subaccount. There can also be a custom domain here. SAP API Management offers different tabs with different functionalities in the View API. The Resources tab is the most important. The resources describe the REST functionalities (GET, POST, and so on) 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 apply the OpenAPI format, a vendor-neutral description standard, to define new APIs, or modify existing ones. The following component diagram illustrates the connections and artifacts that are generated, as indicated by the grey shading.

The graphic shows a component diagram with the generated connections and artifacts marked with green and red 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 Proxy.

Prerequisites

You have successfully finished the previous exercise.

Outcome after this exercise

Familiarize yourself with the OpenAPI specification and its implementation using the API Designer tool.

What do you learn within this exercise

You will gain the knowledge in how to use the API Designer to transform your API into the SAP API Management.

Steps

  1. Explore the API Designer, a design-first approach.

    1. Navigate to ConfigureAPIs.

      Choose Configure > APIs.
    2. Choose your API Proxy.

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

      Choose Edit > Edit in API Designer.
    4. Check out the API Designer.

      • Screenshot of the Check Out options. Information about the options is provided in the following text.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 a server implementation in different languages and Frameworks (Node.js, Java -Spring, Java EE)
    5. Choose every menu entry to check out how they work.

  2. Explore the API specifications.

    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/

      Screenshot of the API Designer overview.
    2. OpenAPI is the standard for describing REST-based interfaces. More information can be found here: https://www.openapis.org/. Here, the OpenAPI Specification 3.0.0 (1) is used.

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

    4. Path blocks describe the resource context. Every resource context is visualized with the Swagger UI (3). You can find more here: https://swagger.io/tools/swagger-ui/

Log in to track your progress & complete quizzes