API Designer

The API Designer is a Graphical User Interface for creation and configuration of API Definitions. API designer makes it easy to define and update API at any stage of designing. It makes APIs reusable for many applications by just adding that API to the application attributes.

Basics of API Designer

Before we dive fully into API Designer, it makes sense to look in a little more detail what is Rest API and its operations.

REST API

A REST API is an application program interface (API) that uses HTTP requests to GET, PUT, POST and DELETE data.

A REST API is a defined set of interactions that use the HTTP protocol, typically by using JSON or XML as the data format that is exchanged. For example, a data request might use an HTTP GET method, and a data record might use an HTTP POST method. The choice of data format depends on the type of application that is calling the API. JSON is commonly used for web pages or mobile applications that present a user interface (by using JavaScript or HTML), whereas XML is often used for machine-to-machine scenarios.

API Operations

An operation is a unit of a REST API that you can call. An operation comprises an HTTP verb and a URL path that is subordinate to the context root of the API. By configuring the operation, you define how the API is exposed to your developers.

  • GET - Retrieves data from the server.

  • PUT - Sends data to the server for processing.

  • POST - Updates data that is stored on the server.

  • DELETE - Removes data from the server.

  • PATCH - Applies partial modifications to an operation. Unlike the PUT method, the PATCH method applies an incremental change rather than replacing the entire operation.

  • HEAD - Requests the same response as to a GET method call, but without the response body. This method is useful for retrieving information that is written in response headers, without having to transport the entire content.

  • OPTIONS - Retrieves the HTTP methods and other options that are supported by a web server or an operation, without implying a resource action or initiating an operation retrieval.

API Designer in Neptune DXP - SAP Edition

An API Designer is to generate Rest API from SAP Data to access SAP Data.

SAP classes can be exposed as a Rest API which can be consumed by any third-party applications that can consume these like any other API. Learn how easy it is designing an API in Neptune DXP - SAP Edition and expose the SAP system to the outside world.

These APIs can be used by Neptune DXP - Open Edition or any other Rest API consumer App. Use Swagger UI to run and test your API.

Caution

The Rest API feature in Neptune DXP - SAP Edition is designed to expose SAP. It is not designed to consume other APIs into SAP.

Prerequisite Settings

  • The class that is supposed to exposed as Rest API should implement the interface ‘/NEPTUNE/IF_RESTAPI’.

  • The methods that can be as Operations should be declared Public.

  • The attributed that can be Properties in API should be declared Public.

API Class in SAP backend

Class Interface:

width-800

Attributes:

api designer attributes

Methods:

api designer methods

Open API Designer

Open API Designer Administration Page by selecting the Connectivity → REST API → API Designer from the left menu Panel of the Cockpit. This will display the list of APIs available on the system.

api designer interface

Add new API

From the API Designer Administration Page, Click the "Add" button. This will open the API configuration Editor.

api designer add api

Fill out the relevant information.

API

Name: Name of the API

Path: This is the URL where your API can be accessed. This path needs to be unique across the system. Our syntax check will handle that.

Data Provider Class: (DPC) This is where you code your ABAP. Create a new class in SE24, and add interface /NEPTUNE/IF_RESTAPI.

Package: If you want to use the SAP transport system, add the package to the API or use $TMP to avoid transport.

Description: Description of the API

Version: Current API version. Increase this number to detect upgrade need in Neptune DXP - Open Edition using the API Discovery Tool.

Settings

RFC Destination: Use the API in your GW server, and run the DPC in a backend system.

api designer settings

Allow ICF SubNode: Allow a custom node in SICF. Needs to be a child of /NEPTUNE/API/ node.

api designer node

Stateful: Enable stateful functionality if you need the DPC to keep the data in memory between requests to achieve paging or other needs. We do recommend using stateless.

Trace all operations: Enable this to monitor API performance and usage for all operations in the API.

api designer performance

Disable: De-activate the API for all users.

Contact

For documentation of the API, visible in Swagger UI and Swagger description.

api designer swagger description

View of contact details on Swagger UI.

api designer swagger view

About

API documentation could act as both a reference and an educator, letting developers quickly obtain the information they are looking for at a glance, while also reading through the documentation to glean an understanding of how to integrate the resource/method they are looking at.

API Documentation can provide the following information:

  • A clear explanation of what the method/resource does.

  • A list of parameters used on this resource/method, as well as their types, special formatting, rules and whether or not they are required.

  • Links to additional resources like media, documents etc.

  • API usage.

Policy

Add restriction to API usage and assign a policy the user needs to be able to use the API.

api designer policy

Can also Enable / Disable the visibility of Policy.

DPC

View your Data Provider Class ABAP code.

Editing of code is not possible here. It’s in display mode only.

api designer abap code

Where Used

Shows the list of the applications using this API.

api designer where used

Add Operation

To add operations, click on ‘+’ beside Operation and fill out the details (choose from drop-down list):

api designer add operation

Operation Information

api designer operation information

General

Path: This is the operation path of the API. /NEPTUNE/API/{api path}/{operation path}

Method HTTP: Set the HTTP method to be used: GET, PUT, POST or DELETE

Method Data Provider class: Public method from SAP ABAP Class. (method from DPC to be processed)

Settings

Enable Trace: Choose if it wants to monitor performance and usage of API in API Trace.

Disable: De-activate the operation for all users.

Information

Description: Description of the Operation

Summary: Short description of the Operation. Used in Swagger UI and Swagger description

Tags: Group your Operation. Used in Swagger UI and Swagger description

Request

This is a display mode of your DPC Methods parameters defined. This will be the API Parameters you can use in the API. If you have a POST/PUT HTTP Method, you also need to set data to be sent to SAP.

api designer request

Response

Set the data your API Operation will send to the client.

Receive: Receive the data from the JSOn response.

Compress: Removes KEY/VALUE in the JSON response when the VALUE is empty.

api designer response

On the ‘Receive’ column you can set which parameters to be received in operation. Finally, Save, and your API is ready.

Delete API

To Delete the complete API, Click on the Delete button( shown in Image at Top Right Position), confirm before deleting, this action will delete the API permanently.

api designer delete

Delete Operation

To delete the API operation, choose the operation and click on the "delete" button, confirm before deleting, this action will delete the API operation permanently.

api designer delete operation