Connect Dynamics CRM With Postman Tool Environment

Introduction

During certain scenarios, we must quickly test Dynamics CRM Web API Requests. We can leverage Postman Tool to achieve this. As an example, here we are going to explore how to create an Environment with Postman Tool.

Step 1

Open Postman Tool, click on Environments, and then click on the + button and name it as Dynamics CRM as shown in the below figure.

Connect Dynamics CRM with Postman Tool Environment

Step 2

After step 1, we need Dynamics CRM web API URL, so for that, we have to open the existing CRM Environment and navigate to Settings-> Customizations -> Developer Resources, copy Uri part of Dynamics CRM Environment from Service Root URL, and remove it from /API as shown in the below figure.

Connect Dynamics CRM with Postman Tool Environment

Step 3

After step 2, now navigate to the Postman tool environment and add Variables like below,

VARIABLE

url

For Initial Value provide the API value that we extracted from Step 2

INITIAL VALUE

https://orgfea8bbba.api.crm.dynamics.com

as shown in the below figure.

Connect Dynamics CRM with Postman Tool Environment

Step 4

After step 3, we must navigate to the Azure portal through portal.azure.com using Dynamics CRM Environment and open Azure Active Directory then Applications, select created application and copy application /client id for the app which we registered in the previous post as shown in the below figure.

Connect Dynamics CRM with Postman Tool Environment

Step 5

After step 4, now navigate to the Postman tool environment and add Variables like below,

VARIABLE

clientid

For Initial Value provide the API value that we extracted from Step 4

INITIAL VALUE

 01ae7ef3-1658-4daa-80a2-f13dc1234567

as shown in the below figure.

Connect Dynamics CRM with Postman Tool Environment

Step 6

After step 5, we need Dynamics CRM web API URL, so for that, we have to open the existing CRM Environment and navigate to Settings-> Customizations -> Developer Resources, copy the version number of Dynamics CRM Environment from Service Root URL and as shown in the below figure.

Connect Dynamics CRM with Postman Tool Environment

Step 7

After step 6, now navigate to the Postman tool environment and add Variables like below,

VARIABLE

version

For Initial Value provide the API value that we extracted from Step 5.

INITIAL VALUE

9.2

as shown in the below figure.

Connect Dynamics CRM with Postman Tool Environment

Step 8

After step 7, now navigate to the Postman tool environment and add Variables like below

VARIABLE

webapiurl

INITIAL VALUE

{{url}}/api/data/v{{version}}/

as shown in the below figure.

Connect Dynamics CRM with Postman Tool Environment

Step 9

After step 8, now navigate to the Postman tool environment and add Variables like below,

VARIABLE:

callback

INITIAL VALUE:

 https://callbackurl

as shown in the below figure.

Connect Dynamics CRM with Postman Tool Environment

Step 10

After step 9, now navigate to the Postman tool environment and add Variables like below

VARIABLE

authurl

INITIAL VALUE

https://login.microsoftonline.com/common/oauth2/authorize?resource={{url}}

And then click on the save button as shown in the below figure.

Connect Dynamics CRM with Postman Tool Environment

Step 11

After step 10, we must test the created environment by considering a Get Request and select Environment as Dynamics CRM, and provide URI as

{{webapiurl}}WhoAmI

 as shown in the below figure.

Connect Dynamics CRM with Postman Tool Environment

Step 12

After step 11, select Authorization Tab and Select Type as OAuth2.0 and Add authorization data to Request Headers, and click on Get New Access Token as shown in the below figure.

Connect Dynamics CRM with Postman Tool Environment

Step 13

After step 12, a new window pops up. Provide CRM user name and password for the first time when we are connecting through the environment as shown in the below figure.

Connect Dynamics CRM with Postman Tool Environment

Step 14

After step 13, if everything works fine as configured then one should see the manage tokens window click on Use Token as shown in the below figure.

Connect Dynamics CRM with Postman Tool Environment

Step 15

After step 14, now click on Send request and observe the Body section with user id details of the logged-in CRM User and the status as 200 as shown in the below figure.

Connect Dynamics CRM with Postman Tool Environment

Note:

  1. Download Postman tool from here [In this example used Desktop Postman tool]
  2. Dynamics 365 online trial instance here
  3. Azure Active Directory Admin Center here
  4. In case if 401 unauthorized error occurs, then open the app in the Azure portal and navigate to Manifest and provide oauth2AllowImplicitFlow as true as shown in the below figure.

    Connect Dynamics CRM with Postman Tool Environment
     
  5. In Case an invalid token error occurs during login as specified in Step 13, then go to Post Man Tool Environment and copy call back URL value https://callbackurl and then open Azure Active Directory and select created App and under App, go to Authentication tab and under Redirect URI’s add a new entry with value https://callbackurl and save it as shown in the below figure.

    Connect Dynamics CRM with Postman Tool Environment

Conclusion

In this way, one can easily test Dynamics CRM Web API Requests using Postman Tool Environment.