REST API SAP S/4 HANA Integration
Add Data Source with HANA Basic Authentication
Follow below steps to add Data Source with HANA basic authentication:
-
Go to Connections.
-
On Data Sources tab, click on Add button. Add New Connection pop up will show.
-
On Add New Connection, add below details:
-
Add the name of the new connection you want to add under Connection Name.
-
Under Connection Type, select REST API.
-
Provide the Site URL.
-
Under Authentication, select SAP HANA Basic.
-
Add credentials as per Authentication scheme.
-
Enable System Credentials to use the credentials provided here, for Authentication.
-
Select a Date Format Type.
-
Click on Save.
-
Add Data Connection in Form Solution
-
Go to Solutions.
-
Select a Solution and click on Edit Solution.
-
On the composer, click on Add Data Connection.
-
On Add Data Connection pop up, add the below details:
-
Provide Name of the Data Connection.
-
For type select REST API .
-
Under Connection, select the Data Source created above.
-
API URL by default, shows the Base API URL, as defined while creating the Data Connection. You can click on the three dots and use URL Builder to add parametrized URL.
-
Under HTTP operations, select a value as per current API connection usage. REST API uses HTTP Verb to specify the request type i.e. Read / Update / Delete or Create.
-
Under API Input Schema, click on Browse and provide JSON schema either from File or by directly copying to Text field. Input schema is of the data, that will be sent to API (i.e. Request payload in JSON).
-
Under API Output Schema, click on Browse and provide JSON schema either from File or by directly copying to Text field. Output schema is of the data that will be received from the API (i.e. Response payload in JSON).
-
Under API Error Schema, click on Browse and provide JSON schema either from File or by directly coping to Text field.
-
Under Request Header, specify the expected request headers as per API specification in key value pair.
-
Under Response Header, Specify the expected response headers as per API specification in key value pair.
-
Click OK.
-
-
After adding the schema, we will create field mapping. This step is for mapping the API solution Data Connection Data fields with Form fields. It is same as mapping of “Web Service” or “Reference Data connection” fields with Form fields.
-
Right click on Solution Data connection created above and choose Create Field Mapping.
-
On Field Mapping dialog, add below details:
- Description: A text note for this mapping.
-
Group Name: Group name for Form schema fields. All Form fields will be created within this group.
-
Web Service Name: A mapping name which will be used in Form control or plugins.
-
Select an Operation.
-
Click Next on this dialog.
-
The Field Mapping Parameters dialog will show all API Solution Data connection fields and Form fields, similar to what is shown for Web Service field mapping dialog.
Review or change the form field type or max length as per requirement.
-
Click OK to complete the mapping.
-
-
Once the fields are created, they can be dragged in the composer to generate form fields, buttons and web service control.
Design the Form
Design the Form with the fields created and mapped to API Solution Data connection. Also put Form controls (i.e. Web Service, lookup, query or dropdown) which will execute the API Data connection.
-
Design the Form fields on Form View.
-
Place the Web Service and Button control on Form view. Configure the Web service control and button control to run the API solution data connection upon clicking this button.
-
Deploy the solution.
Test the API Solution Data connection
Launch the form and run the API Solution Data connection.
-
Launch the Form.
-
Click on the configured button to run the API Solution Data connection.
-
Form will execute the API and will show the response data on mapped Form fields.