connecting-systems-services-integration-suite-codejam

Exercise 02 - Exploring the mock services

Before attempting to build an integration between the services, it is important to get familiar with them. The easiest way to achieve this is by using a REST client, e.g. Postman, to interact with the API exposed by the service.

If you are following this exercise outside of a CodeJam event, you can follow the instructions included in the running locally prerequisites page to either run the services locally or deploy them to a Kyma environment part of the SAP BTP.

A couple of things that we need to keep in mind when exploring new APIs/services:

This is an exploration exercise. There are no step-by-step instructions to be completed but questions are included to guide your exploration. I encourage you to be curious about the different aspects of the API available.

At the end of this exercise, you’ll have an understanding of the data that we will be interacting with when building our first integration flow in the next exercise.

🚨🚨 As part of the prerequisites of this CodeJam, you should have made a copy of the repository in your local machine. If you’ve not done this, now would be a good time as we will start using some files included in the repository :-). 🚨🚨

Importing collections and environments of the mock services

A collection and a few environments are included in this repository to facilitate interacting with the APIs exposed by the services that we will be using in our integration. The collection and environments for the SAP S/4HANA Cloud mock server and the Business Partner Dependants mock service can be found in the main ./assets/Postman folder.

👉 Import the collection and the environments provided to your Postman client. The files are located under the root folder of the repository -> ./connecting-systems-services-integration-suite-codejam/assets/postman

List of the files that you need to import to Postman:

Collection:
- assets/postman/connecting-services-integration-suite-codejam.postman_collection.json

Environments:
- assets/postman/API Management.postman_environment.json
- assets/postman/BP-Dependants-Americas.postman_environment.json
- assets/postman/BP-Dependants-EU.postman_environment.json
- assets/postman/BP-Dependants-localhost.postman_environment.json
- assets/postman/Cloud Integration Instance.postman_environment.json
- assets/postman/S4-BP-Mock-Server.postman_environment.json

Import objects to Postman

The collection contains all the requests that we can make to the services. These are the requests that we need to get familiar with before we can build our first integration flow.

SAP S/4HANA Cloud - Business Partner mock service

In Exercise 1, we had a brief look at the Business Partner API. This mock service is based on that API. Let’s start by opening a request and selecting the correct environment.

👉 Select the All Business Partners request in the s4-bp-mock-server folder and select the S4-BP-Mock-Server environment.

Open request and select environment in Postman

⚠️ If you are running the services locally, you will need to select the S4-BP-Mock-Server-localhost environment

You’ll notice in the gif above that there is a placeholder in the URL called **. This placeholder is a variable in Postman. At first, the colour of the variable is red, this is because Postman is unable to resolve the variable. It changes to orange after selecting the environment - S4-BP-Mock-Server, meaning that Postman can substitute the variable, with a value, when we execute the request.

👉 We are now ready to send the first request to our server. Click the Send button to send a request to the server. The server response will be shown in the response section below.

Click send to get a response

If the call was successful, you will see a response similar to the one above. The JSON payload contains the Business Partner data that we are after. If you’ve interacted with SAP S/4HANA OData services before you’ll see a familiar response structure. The service is a mock OData service. Not all OData functionality is available but we can $select fields and $expand some attributes.

If you want to learn the basics on OData, I recommend checking out the Hands-on SAP Dev, Back to basics: OData with @qmacro - https://www.youtube.com/playlist?list=PL6RpkC85SLQDYLiN1BobWXvvnhaGErkwj

👉 Now, let’s dive deeper into the requests available on this server. For that, make sure to go through all the questions listed below:

Custom Service - Business Partner Dependants mock service

Let’s start by validating that the API is up and running

👉 Send a Ping request to the service. Change to the bp-dependants-mock-service folder in the collection and set the environment to BP-Dependants-*, Open the Ping request and click the send button.

If the call was successful, you will see a response similar to the one below.

{
    "status": "Service is running"
}

The Business Partner dependants mock service will return all the dependants for a Business Partner. As mentioned in the overview of the SAP CodeJam, we have separate services to serve America’s and European data. Separate environments have been provided to be able to communicate with each service.

👉 Now, let’s dive deeper into the requests available for this service. For that, make sure to go through all the questions listed below:

Summary

Now that you are familiar with the APIs and the data included in their responses, we are ready to start building our first integration flow.

Further reading


If you finish earlier than your fellow participants, you might like to ponder these questions. There isn’t always a single correct answer and there are no prizes - they’re just to give you something else to think about.

  1. Which API methods, of the different mock services, do you consider we will need for our integration?
  2. OpenAPI specs are included in the SAP Business Accelerator Hub, do you know where you can find them? What if you import one of them to Postman?

Next

Continue to 👉 Exercise 03 - Building the first integration flow