Collaborate using SAP Jam APIs in SAP Cloud Platform
Few weeks back, I had a requirement from a customer who was looking to use SAP Jam as a repository for images which are captured through a mobile App. This app is based on SAP Fiori and is deployed on SAP Cloud Platform.
SAP Jam has a rich set of APIs which can be used to interact with a particular SAP Jam tenant. For example, you can use APIs to create discussions, view feeds, upload documents etc. These APIs have been recently made available in API Business Hub centrally along with all other APIs exposed from various SAP solutions.
These APIs are connected to a sandbox system and are publicly available for anyone to view and test them. You can obtain an API Key and use the “Try it out” button to test these APIs.
Also provided are code snippets to invoke these APIs in different runtimes.
I would also like to point you to the JAM OData API documentation. You can go through the complete list of APIs here. You should be able to easily browse through these APIs and try them out from the interactive tool which has been provided.
I really like the option to provide an oAuth2 access token (at the top) and start interacting with the SAP Jam tenant using the provided APIs. How do you obtain an oAuth2 access token?
Before you get started with building your applications, you would need to setup trust between your SAP Jam tenant and SAP Cloud Platform subaccounts. Phil Cooley has explained this beautifully in his blog post on “SAP JAM Collaboration – Set up in Productive Environment”
Once you have setup the trust and created an oAuth client, you have an option to create an oAuth2 access token (as shown below). You would just use this oAuth2 access token in the interactive tool explained earlier and interact with your SAP Jam tenant using those APIs.
This works great when you have a Developer Edition which you can spin up from SAP Cloud Platform trial accounts. You can easily obtain an oAuth token and start to get familiar with the SAP Jam APIs. In my case, I was dealing with a JAM Enterprise Edition which was provisioned separately. Within, SAP Jam Enterprise Edition you DO NOT get an oAuth token when creating oAuth clients. The only way to get access to the token, would be via an application which could write and deploy on SAP Cloud Platform.
I did some research and found couple of tutorials in SAP Help. I was also pointed to this GitHub where lot of sample code has been made available. However, the challenge I had was that all these sample codes were for Java based application development. I was building a HTML5 app and didn’t have any resources in my account to import these Java apps and test the API calls.
I then came across this latest tutorial which shows how to use sample reference applications and create projects within WebIDE. This is a series of tutorials which helped me to create applications on SAP Cloud Platform which could interact with my SAP Jam tenant.
So if you are using SAP Jam Enterprise Edition, you would need change the destination for “sapjam_developer” as shown below.
Here is the screenshot of the reference applications which are provided to quickly test the APIs.
There are three reference applications. The first one is for Forums. As an end user, I can select the group from the right hand side and navigate to Discussions,Ideas etc and collaborate from within this application without having to jump to my SAP Jam tenant.
Similarly, there is also an application to provide SAP Jam feeds. I can view and post new contents using this app.
The last application is to manage SAP Jam groups. I can see the list of groups which I have subscribed to and can also create new SAP Jam groups using this existing templates and set group permissions.
These reference applications are a good starting point for developers to start interacting with SAP Jam APIs and I would highly recommend them to anyone looking to build applications on SAP Cloud Platform which leverage the collaborative capabilities of SAP Jam.