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:
- Find your service in Eclipse ADT.
- Go to the service URL (this will open your browser).
- Open the Developer Tools and find the request to your service.
- In the request header find the http header property "Cookie" and copy this value.
- In Postman create an environment variable containing the copied value.
- 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