Skip to Content
Technical Articles

SAP Cloud Platform Process Visibility – Publish data using APIs

SAP Cloud Platform Process Visibility provides visibility into end-to-end processes. These processes can span across multiple landscapes i.e cloud, on-premise or hybrid. Further, these processes can span across multiple applications be it SAP or non-SAP. To provide visibility on these processes, the applications must push events. These events are consumed by Process Visibility to provide insights on your running processes. In this blog, I will explain how you can use SAP Cloud Platform Process Visibility APIs to publish data from applications or services running on cloud or on-premise landscapes.

Prerequisites

  • Setup SAP Cloud Platform Process Visibility service in your Cloud Foundry account. Refer   blog  for details
  • You need to have PVEventSender role of process visibility service assigned to your user. For more details on roles and authorization refer help document

Event format supported by Process Visibility

Applications can push events to Process Visibility in the format given below. To know more about the event structure ,refer help document

{  
   "processDefinitionId":"onboard",
   "processInstanceId":3567,
   "eventType":"CREATED",
   "timestamp":"2018-08-25T02:07:42Z",
   "context":{  
      "CANDIDATE_ID":3361,  
      "JOB_REQUISITION_ID":901,  
      "FIRST_NAME":"John", 
      "COUNTRY":"United Kingdom",  
      "JOB_OFFER_DATE":"2018-08-25T02:07:42Z",  
      "CURRENT_TITLE":"Engineer",  
      "EMAIL_ID":"johndoe@sap.com", 
      "JOB_APP_STATUS":"Offer",  
      "LAST_NAME":"Doe",  
      "JOB_APPLICATION_ID":2002  
   }
}

Pushing events to Process Visibility

Applications can publish events to Process Visibility using the Data Acquisition REST APIs. The back-end applications can invoke API via OAuth 2.0 protocol. OAuth 2.0 is the basic security protocol for any native application development using REST APIs.

Consuming Data Acquisition API

Applications can invoke the  Data Acquisition APIs in multiple ways.

  • Invoking APIs from application back-end using Rest client libraries
  • Configuring Data acquisition API to trigger event publishing from any event enabled applications for example: SuccessFactors Integration Center, for details refer blog

Below section illustrates how to  push data using Data Acquisition API via Postman REST Client.

  1. Access the service key created in the set up step. You will need following details from the service key to fetch the OAuth token
      • URL: Token endpoint URL
      • Username: OAuth client id
      • Password: OAuth client secret

  2. Use the Token Endpoint to fetch the OAuth Token. The complete endpoint is formed by appending /oauth/token to the base URL
  3. Configure the Authorization header using the OAuth token fetched in above step 
  4. Set the event data as request payload and invoke the API. On successful publishing of the API will return status code HTTP 204.

Above example illustrates key information required to push data using the Data Acquisition API.  Note, the same set of information should also be used when invoking the API directly from the application back-end. To summarize

  • Fetch the OAuth token
  • Use the fetch OAuth token to configure Request authorization header
  • Set the event data as Request payload
  • Invoke API using HTTP POST method

Any failure in ingestion of events can be monitored using the Event Acquisition application.

You can get started with Process Visibility Service using your SAP Cloud Foundry trial account and gain visibility into your end-to-end processes in almost no time. All you need to do is,

  • Enable event publishing using Process Visibility Data Acquisition APIs
  • Model your Scenario and activate

In the next blog, I shall illustrate how the Data Acquisition API can be used as a web hook with Enterprise Messaging.

Be the first to leave a comment
You must be Logged on to comment or reply to a post.