Example Scenario: Using Calendar APIs in SAP BTP Build Process Automation

Learn how you can use the calendar APIs in an automated process that allows you to start a workflow in the SAP Analytics Cloud calendar when another step in your automated process is completed.

In addition to automatically starting a workflow in the calendar, you can automatically check whether the workflow is already completed and proceed with the next automated steps once the first one is completed. You also have the option to change the status of your workflow to react to outcomes of other automated steps, for example: Suspend or cancel the workflow if it is no longer needed.

Creating Actions Using the Calendar APIs

Procedure

  1. Download the calendar API specification (Calendar Service) from the SAP Business Accelerator Hub: https://api.sap.com/Information published on SAP site

    The calendar API specification is required to create actions that you need when you set up an automated process.

  2. In SAP Build, go to Connections Actions, and choose Create.
  3. Choose Upload API Specification as API source.

  4. Upload the calendar API specification that you downloaded from the SAP Business Accelerator Hub.
  5. Select the APIs you need to proceed with your process: In this example you need the POST and the GET API.
  6. To successfully run the POST API, you need to enable the CSRF token.
    1. Choose Settings in the top right corner next to your user icon.

    2. In the Project Settings dialog, activate the setting Enable CSRF.

    3. Under Token Fetch End Point, change the end point to /csrf.

  7. In the POST API, add the CSRF end point as well: Under CSRF, change the value to /csrf.

  8. You can now test the API on the Test tab:
    1. Under Destination, select a destination that points to your SAP Analytics Cloud tenant.

    2. Enter values with which you want to test the API.

Results

Once you've provided all the information as input parameters, you can release and publish the actions to use them in process automation.

Using the Calendar APIs in the Process Automation

The following graphic shows an example process for using the APIs in an automated process. This is just a basic example and should give a brief overview of how to use the calendar APIs in action. You can extend the process with any steps to meet your requirements.

The entry point of this process is an input form in which the user can enter the ID of the event to be instantiated. You can replace the entry point with any action that should start a workflow in the SAP Analytics Cloud calendar. If you have already saved the ID as referenceEventId, you don’t need to insert the ID of the event in an input form again.

Once the new event is created, the automated process checks the status of the event every 6 hours using the GET API. You can define how often the event should be fetched to check the status. If the instantiated event runs for several weeks, it might make sense to check every day. If it only runs for an hour, you might want to check every 5 minutes.

As soon as the condition is fulfilled, in this example the event should have the status Successful, an email is sent to inform users that the event is completed.

Your process doesn't have to end with an email. You can add further steps that are required once the workflow in SAP Analytics Cloud has reached a certain status or progress.