Skip to Content
Technical Articles
Author's profile photo Søren Hansen

BTP ABAP Environment – OData testing via Postman

All.

This blog is based on the knowledge from this blog. But providing a more streamlined approach, when you want to test your OData services on the BTP ABAP environment from Postman.

It may be somewhat tricky to setup authentication for your service calls in Postman against the BTP ABAP environment, but I will show how it can be done in an easy manner.

The steps are:

  1. Find your service in Eclipse ADT.
  2. Go to the service URL (this will open your browser).
  3. Open the Developer Tools and find the request to your service.
  4. In the request header find the http header property “Cookie” and copy this value.
  5. In Postman create an environment variable containing the copied value.
  6. Assign this variable to your OData calls.

The cookie has a lifespan of approximately 4 hours. So you will only have to update it once every 4 hours, and you only have to set it in one location in Postman.

 

Step 1: Find your (or any other) service in Eclipse ADT.

Step 2: Click the link “Service URL”.

Your browser opens – login to your SAP BTP account if needed.

Step 3: Open Developer Tools

Click F12 or Ctrl-Shift-I (In Windows) to open the Developer Tools.

Go to the tab “Network” – refresh via F5 if the list is empty.

Identify the request being made to your service. Click on the request in the Name column (in this case the text “?sap-client=100”).

Step 4: Identify the http header property named “Cookie”

In the Request Headers section of the http Header copy the value of property “Cookie”.

Step 5: Open Postman and create an environment.

Create an environment (in my case “BTP – SOH821”) and create the variable “Cookie”.

Paste the value of the Cookie property from the browser Developer Tools.

PS: Remember to assign this environment to your Postman session (in the top right corner).

Step 6: Assign the environment variable to your OData call

In the Postman request go to the Headers section and create a new property called “Cookie” and assign the value from your environment variable via double-curly-brackets as displayed above.

Save this request in a collection, and make sure to set this property in all your requests.

Whenever the Cookie expires perform steps 1-4 and copy the value to environment variable. And you can keep testing for another 4 hours until it expires again.

Happy testing.

 

Søren Hansen

Assigned Tags

      5 Comments
      You must be Logged on to comment or reply to a post.
      Author's profile photo Mio Yasutake
      Mio Yasutake

      Thanks for sharing this tip.

      I have used another approach explained below.

      https://answers.sap.com/answers/13550136/view.html

      Author's profile photo Søren Hansen
      Søren Hansen
      Blog Post Author

      Hi Mio.

      I really like your approach, but I can't get it to work.

      I get the Access Token from BTP and click "Use Token", but I do not get authenticated when I send my Postman request. I can see the Bearer token in the "Authorization" header.

      I don't exactly know why it is not working.

      It seemed to me that I did not need to create the xsuaa service instance. I was able to get a token  when using my ABAP instance service keys.

      But neither was working anyways, so it didn't make a difference for me.

      The approach described by me in the blog is however still working 🙂

      But thanks for the input.

      Søren Hansen

      Author's profile photo Mio Yasutake
      Mio Yasutake

      Hi Søren,

      You' re right. You don't need xsuaa service instance but you can get a token with abap instance service key. It's strange that you're not authenticated...

       

      Best regards,

      Mio Yasutake

      Author's profile photo Gregor Wolf
      Gregor Wolf

      Hi Søren,

      are you aware of the possibility of Syncing cookies with Postman Interceptor?

      Best Regards
      Gregor

      Author's profile photo Søren Hansen
      Søren Hansen
      Blog Post Author

      Hi Gregor.

      No, I was not aware of this.

      That is a very nice feature, and I can confirm that it is working.

      However I find it a little bit tedious to set up, and if you are not using this on a regular basis, you might have to spend some time figuring out how it is done.

      I am just so used to going in to the developer tools in Chrome, so I find that the easiest to do.

      But very interesting tip.

      Thanks for the input.

      Søren Hansen