Showing posts with label Use Postman for API request. Show all posts
Showing posts with label Use Postman for API request. Show all posts

Thursday, December 29, 2022

How to use postman for an API request to CRM

 

How to use postman for an API request to CRM 

In this blog, I have shared a basic idea of how to make a request using the Postman tool.

Before getting into it will share a brief overview of Postman:

If you do not have used it already, download the app to quickly get started using the Postman API Platform. Or, if you prefer a browser experience, you can try the new web version of Postman. Click on the link to Download Postman.

Postman is an interactive and automatic tool for verifying the APIs of your project. It's a free app that can be used for making API calls. You can either directly use it without signing in by clicking on the skip option or you can signup with your personal/official account and use it. save the credentials to use them in the future.

Click on the official Postman site to learn more about the Postman tool.

Follow the step-by-step procedure to post postman requests.
1. Once successfully installed -> Click on the desktop icon to open the Postman.
2. You can skip signing in or Click on signup and create a Postman account like you do for creating a Gmail account. Once you successfully logged in, the below screen will appear.



















3. Click on the Workspace -> New Workspace 

 















4. Create New Workspace -> Add name -> Click workspace and team 


















5. Once created open the workspace which you created -> Click on the + button to add a new collection, Rename it to the proper name (Development_API) -> Click new to create a request (Get, POST, etc.) 




























Now once all above is done, here is the main task you wanted was to create a request using postman. 

-> Before any request, you must get the Access Token else you will receive unauthorized error 401.

1. To avoid 401 error follow the below process to get access the token -> to copy the access token and use it:

URL

https://login.microsoftonline.com/<<tenant-id>>/oauth2/token

Method

POST

Request Header

Content-Type: “application/x-www-form-urlencoded”

 

Request Body

grant_type: "client_credentials"
client_id: "<<client-id>>"
client_secret: "<<client-secret>>" 
resource: "<<resource-URL>>"

Response

{
    "token_type""Bearer",
    "expires_in""6799",
    "ext_expires_in""3567",
    "expires_on""1619762946",
    "not_before""1619179782",
    "resource""https://<<organization URL>>",
    "access_token": " eyJ0eXAiOiJKV1QiLCZCI6Im5PbzNaRHJPRFhFSzFqS1doWHNsSFJfS
1hFZyJ9.eyJhdWQiOiJodHRwczovL2V5Y2FzZW1nbXRkZXYuY3JtNC5keW5hbWljcy5jb20vIiwia
XNzIjoiaHR0cHM6Ly9zdHMud2luZG93cy5uZXQvZWJiOGI4MmUtZmUwOS00Yj
dlLWE2YzctZmQzNWY0NDZiZjk2LyIsImlhdCI6MTYxOTE4MjEzMiwibmJmIjoxNj
E5MTgyMTMyLCJleHAiOjE2MTkxODYwMzIsImFpbyI6IkUyWmdZRERid1hWanp
3WkRreDNuW"
}


Note: Access token expires in 30mins so keep generating new access token and proceed

Click on send:














2. Once you get the access token you can use the same in the authorization and do your operation to Get or Post the request using API as shown in the image below:
















To know more click on the references: Build Postman Requests 

Thank you!!

happy learning...