6

Using Postman to test ODATA API in OnPrem system

 2 years ago
source link: https://blogs.sap.com/2022/06/13/using-postman-to-test-odata-api-in-onprem-system/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client
June 13, 2022 2 minute read

Using Postman to test ODATA API in OnPrem system

0 2 124

Introduction:

SAP Logon inbuilt gateway client is an out-of-box tool to test OData API, but if you want to be more efficient, a better tool is needed.

According to official introduction, postman is an API platform for building and using APIs. Postman simplifies each step of the API lifecycle and streamlines collaboration so you can create better APIs—faster. So how can we use postman test our OData API faster and easier.

Backend configuration:

First of all, you need authorization to access the API which is not needed in gateway client. Gateway client will directly use your developer user to access the API, this is obviously not appropriate especially when you want to do some authorization test. Let’s start with creating a role.

  • Create a role named ZPOSTMAN
pfcg.png
  • Add Authorization Default in Menu tab
authorization-default.png
  • Select authorization type based on your service
add-service.png
  • Find you API service
find-service.png
  • Then move to Authorizations tab
authorization-object.png
  • Add all the authorization you need to access your API, these authorization objects can be various according your API.
maintain-authorization-objects.png
  • Generate and save your role.
generate-and-save.png
  • After we have the role, we need to create an user
create-user.png
  • Change User type to B System and provide a password in Logon Data tab.
logon-data.png
  • The most important thing is to assign your role created before to this user
assign-role.png

Then save your user. Now we can move to Postman.

Postman:

  • Create a new collection and add a new request in.
create-collection-and-reqeust.png
  • You can copy and paste your URL from gateway client.
copy-URL.png
  • In Auth tab, select type Basic Auth and enter your created user and password.
user-and-password.png

Then we are good to go!

Note that you may need to explicit assign client in your URL if you get a 401 unauthorized error when sending request. Append “?$sap-client=001” after your URL.

Leave you comments below if you have any questions, and you can also refer to this blog: S/4HANA Cloud API Consumption 101 – Using Postman to Test | SAP Blogs for cloud usage.


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK