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 APIs 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.
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](_images/sap-api-designer.avif)
Add new API
From the API designer Administration Page, select the "Add" button. This will open the API configuration Editor.
![sap add api](_images/sap-add-api.avif)
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](_images/sap-api-settings.avif)
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.
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.
Add operation
To add operations, select ‘+’ beside Operation and fill out the details (select from drop-down list):
![sap api add operation](_images/sap-api-add-operation.avif)
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](_images/sap-api-request.avif)
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](_images/sap-api-response.avif)
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, select the Delete button(shown in Image at Top Right Position), confirm before deleting, this action will delete the API permanently.
![sap delete api](_images/sap-delete-api.avif)
Delete operation
To delete the API operation, select the operation and select the Delete button (highlighted in the Image), confirm before deleting, this action will delete the API operation permanently.
![sap delete operation](_images/sap-delete-operation.avif)
API documentation here.