Neptune DXP - SAP Edition API Creation

To use the Neptune DXP - SAP Edition as a data provider for your application you need to set up apis (connectors) in your Neptune DXP - SAP Edition.

API Designer in Neptune DXP - SAP Edition

Our 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 application. Learn how easy it is to design an API in the Neptune DXP - SAP Edition and expose the SAP system to the outside world.

These API’s can be used by the 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 the 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 be exposed as Rest API needs to implement the interface ‘/NEPTUNE/IF_RESTAPI’.

  • The methods that will be used as Operations should be declared Public.

  • The attributes that will be Properties in the API should be declared Public.

API Class in SAP back-end

Class Interface:

sap class interface

Attributes:

sap attributes

Methods:

sap methods

Neptune DXP - SAP Edition API Designer

Find the API Designer Administration App by using the cockpit search. This will display the list of API’s that are available in the system.

sap api designer

Add new API

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

sap add api

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

Settings

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

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

sap api settings

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.

Disable: De-activate the API for all users.

Contact

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

sap api contact

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.

sap api policy

DPC

View your Data Provider Class ABAP code.

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

sap api dpc

Where Used

Shows the list of the applications using this API.

sap api where used

Swagger UI

Test your API with the open source tool Swagger UI.

sap api swagger

Add Operation

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

sap api add operation

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: Select if 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.

sap api 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.

sap api 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.

sap delete api

Delete Operation

To Delete the API operation, Select the operation and click on the Delete button (highlighted in the Image), confirm before deleting, this action will delete the API operation permanently.

sap delete operation

API documentation here.