Consuming SAP Jam APIs through the SAP API Business Hub
When you start building an application on SAP Cloud Platform and want to integrate it with other SAP applications, a good starting point to look at is the SAP API Business Hub – the central place where you can find all available APIs for SAP products, including the ones for SAP Jam Collaboration.
In this blog I’ll describe how to get access to your own SAP Jam Collaboration developer tenant and how to access its APIs through the SAP API Business Hub.
Please note: In a productive environment the following steps won’t work exactly like described because it will require a SAML/OAuth implementation (more on this later).
How to get your own SAP Jam Collaboration developer tenant?
Getting your own SAP Jam developer tenant is really simple.
- Just sign up for an SAP Cloud Platform trial account here: https://cloudplatform.sap.com/try.html
- Select Neo Trial:
- Click on Services on the left.
- Search for SAP Jam, click on it, and click the Enable button.
- Click Go to Service:
Navigate to the SAP Jam APIs on SAP API Business Hub
Next, you need to find the SAP Jam APIs on the SAP API Business Hub.
Open the API Business Hub via https://api.sap.com/
Search for “SAP Jam”, and open the API package “SAP Jam Collaboration”.
You should have ended up on this URL:
https://api.sap.com/package/SAPJam?section=Artifacts
Drill down into the Group APIs by clicking on it. Now the fun part begins.
Playing around with the SAP Jam APIs
In the API Endpoint field you can see that the API Business Hub is automatically connected to a sandbox system which you can use to directly to interact with the SAP Jam APIs, using the available input fields and the Try Out button. But this sandbox system is shared with everybody else who wants to play with the APIs.
Therefore it makes sense to connect your own SAP Jam tenant to the API Business Hub.
Get your own SAP Jam Collaboration developer edition tenant
You can get your personal developer tenant as part of the SAP Cloud Platform trial via this website: https://cloudplatform.sap.com
If you are looking for a quick guide on how to do that, have a look at this one:
https://help.sap.com/viewer/u_collaboration_dev_help/2e9e408296bc48db9a175106c6964fbc.html
Connect your SAP Jam Collaboration developer edition tenant with the API Business Hub
Go back to the API Business Hub and click Login in the top right corner. Because you are already logged on to the Cloud Platform cockpit and SAP Jam, you should automatically get logged in with the same user also to the API Business Hub.
On the Group Resources screen click Configure next to the API Endpoint drop-down list. Select your automatically connected developer tenant, give it an alias name, click Ok and select the newly added endpoint in the drop-down list.
Next what you need to do is get an OAuth access token that will allow your user from the API hub to authenticate against the SAP Jam tenant. In a productive scenario you will programmatically have to get such an OAuth token (for details on that please check the documentation here: https://help.sap.com/viewer/u_collaboration_dev_help/ac2b4a50dc6d4324a69c19f645e353ef.html) But in your SAP Jam developer edition tenant this has been simplified, so you can get started really, really fast. The only thing you need to do is create an OAuth client in your Jam tenant (on this page: https://developer.sapjam.com/company/oauth_clients/), view it after creation and copy the OAuth access token:
Last thing is to get this access token into the API hub. For that navigate to the Groups resource and the GET operation for /Groups.
If you opened up the GET operation you can add a Header-parameter with the Add-button. As Parameter enter “Authorization” and as value enter “Bearer <your access token from Jam” (example: “Bearer xxxxxxxxxxxxxxxxxxxxxxxxx”>.
Then hit the “Try it out!” button.
IMPORTANT: Make sure to use the button that comes after the Response Messages. If you use the button at the top of the operation you will get a 403 error.
What you will get back in the Response Body is a list of all groups that exist in your SAP Jam developer edition tenant, including configuration information about each group. With the ID of each group you can then drill down further by using it as an input parameter for example for the GET /Groups(‘{Id}’) operation.
Play around with more APIs
Now that you know how to use the SAP Jam APIs through the API Business Hub, try out a few things, such as to create a forum question in a particular group in Jam, or to read a forum question and then post an answer to it, all using the APIs.
Get the code
To make use of these APIs calls in your own application the API Business Hub offers a great feature to automatically generate code snippets for the most commonly used programming languages in the SAP world, including ABAP and SAPUI5. Just hit the Code Snippet button for that.
Feedback welcome
We’re always hard at work expanding and enhancing the SAP Jam APIs. While there are many available today, we are always looking to add more based on the kinds of scenarios customers are looking to support. If you have an idea, suggestion, or comment, let us know!