Skip to Content
Technical Articles
Author's profile photo Nabheet Madan

SuperQuick way to consume API’s from SAP API Business Hub via Postman

Background

The trigger for this blog has its background in our super cool #HandsOnSAPDev session by DJ Adams on last Wednesday. In the session DJ was showing us how to consume SAP API Business Hub workflow API’s over curl. It occurred to me why do I have go to the SAP API business hub to actually try out these API’s why can’t I do something in our good and reliable Postman. I can definitely go and manually create an API call in postman but that is too cumbersome and irritating.  In this world of openAPI why can not we have some simple solution. So this blogs talks about discovering such simple solutions

Lets Explore.

I causally opened my postman app and started exploring around, looking for a way to make this possible. The first thing which caught my eyes was this new tab API’s with beta. I thought of exploring it.

On clicking create API it opened a tab where you can define your API specification wow:). I was like amazed not only define you can develop, test and observe also. We will explore other things in coming blogs.

What I see is an option to import you API specification via file.

I thought if somehow SAP API Business Hub can export those specifications then I can import here and my work is done right?. I vaguely remember seeing in somewhere  so I went to API business hub under details tab and there we have it, BINGO

All I did was download the JSON specification and import it here

Click on beautifier and wrap string to make it readable.

We are using OpenAPI3.0 version so we need to the version details

"openapi": "3.0",
"swagger": "2.0",
"info": {
         "version": "v1",
          "title": "***"
}

Click on Save and then Generate Collection

Under Collection you can see we have all different endpoints available.

Lets try one of them, as can be seen below baseUrl is environment variable.

Lets create this variable and assign the endpoint root url. Please watch the session video of how to set the configuration and get the url.

We are ready, good to test out things. Please make sure under authorization tab you are providing the basic authorization. BINGO we have our all workflow definitions available.

So What is next?

So now you can see how easy it is to set up your Postman once and for all. One can download the specifications as per his/her own need use it. I believe we have just scratched the surface of this new API tab in postman, we will explore how to create custom API, test and monitor in coming blogs. Feel free to provide your feedback.

Assigned Tags

      4 Comments
      You must be Logged on to comment or reply to a post.
      Author's profile photo Andreas Gerstner
      Andreas Gerstner

      Hi Madan,

      good explanation. I was wondering if all APIs will work as JSON? I tried it with the following:

      https://api.sap.com/api/API_PRODUCTION_ORDERS/overview

      but for me on postman or on API Beta Cockpit I am not getting a response as JSON. I manually added to header "Content-Type" - "application/json" but it just responds with the XML. any idea why?

       

      thanks

      Andreas

      Author's profile photo Andreas Gerstner
      Andreas Gerstner

      I just got it working with JSON. it requires two entries:

      • "Content-Type" - "application/json" and
      • "Accept" - "application/json"

      then it is working fine.

       

      Author's profile photo Richard Kleibl
      Richard Kleibl

      Hello,

       

      thanks for the Blog. I tried it with some OData APIs and always getting some errors on importing them to Postman:

      Error while importing Swagger 2.0: (Patchable) schema type must not be an array

       

      I checked the file also with the swagger editor and it showed me some errors.

      kind regards

       

      Author's profile photo Pieter Janssens
      Pieter Janssens

      Same issue here Nabheet Madan
      E.g. https://api.sap.com/api/EmployeeCentralEC/overview