The OData API of SAP Cloud Platform Integration enables you to access the stored data (e.g. to implement a monitoring project) or to update data (e.g. to create/update/delete partner directory content). In the past these OData API entities were only described in SAP Help Portal (see SAP Help Portal: SAP Cloud Platform Integration – OData API), but now with SAP Cloud Platform 1802 release (14-Apr-2018, v2.39.x) the first version of this API is published in the SAP API Business Hub.
API Package “SAP Cloud Platform Integration”
This package contains the artifact list, which enables you to trigger the following actions:
- Integration Content
Get the list of deployed integration artifacts
Deploy/undeploy integration artifacts
- Log Files
Get http and trace log files
- Message Processing Log
Get information about the message processing including error information, attachments etc.
- Message Store
Get the stored payload with payload attachments and header properties
- Partner Directory
Create, read, delete the Partner Directory content
Image 1: New API Package “SAP Cloud Platform Integration” in SAP API Business Hub
“Try It Out!”
You have two different opportunities to test the API directly in the API Business Hub. Either you use the API Sandbox or you configure an API endpoint for your tenant account. For both options you need to be logged on with your SAP Community User.
It is possible to directly test the provided GET methods via API Sandbox (see SAP Help Portal: SAP API Business Hub- Trying Out PIs in Sandbox Environment), which is the default “Try it out!” feature.
The API Sandbox contains all test data for the provided API artifacts.
Example: GET All Deployed Integration Artifacts
Select the artifact from the “Artifacts” tab, which you want to test.
Image 2: Select artifact
In the “RESOURCE” tab open the method list for an entity (“Show/Hide”).
Image 3: Open method list of an entity
Click on the “GET” method header, fill possibly the required parameters and click on “Try it out!”.
Image 4: Trigger test by clicking on “Try it out!” button
Afterwards you could see the received response directly underneath.
Image 5: Received response
Your Tenant Account
Alternatively to API Sandbox, you could test all methods (GET, POST, PUT and DELETE) in your SAP Cloud Platform account by configuring API endpoint (see SAP Help Portal: SAP API Business Hub – Trying Out APIs in a Productive Environment).
For creating your API endpoint, click on “Configure” for an opened artifact.
Image 6: Configure an API endpoint
Select the region specific host of your tenant account:
Image 7: Select region specific host of your tenant account
Enter an endpoint alias, the account short name and the SSL host to complete the required URL for the API call and add your user credentials to complete the configuration.
Image 8: Enter the required attributes and the credentials of your tenant account
As prerequisite for API call via your configured API endpoint your user needs to be assigned to the required roles (see SAP Help Portal: SAP Cloud Platform Integration – Tasks and Required Roles).
CSRF Token Handling
For each write access a CSRF token is required. The corresponding fetch method “CSRF Token Handling” is part of each API package artifact with at least one write method.
To get the required CSRF token, at first the GET method needs to be called with the parameter X-CSRF-Token = ‘Fetch’.
Image 9: Fetch CSRF-Token
The received token must be copied from the response header.
Image 10: Copy CSRF-Token from response header
Afterwards this copied token needs to be entered into the X-CSRF-Token parameter of the POST, PUT or DELETE method.
Image11: Paste the copied CSRF-Token into the corresponding parameter value – e.g. for DELETE IntegrationRuntimeArtifacts to undeploy an integration flow
It is planned to further enhance the OData API of Cloud Integration (e.g. configure/deploy integration flows of “Design” section) and to update this package in the SAP API Business Hub accordingly.