If you want to test the WEB API in Dynamics 365 CRM using Postman, here’s what you need to do to setup Postman to connect to Dynamics 365’s Web API
There are 2 parts to this setup –
- Registering an App in Active Directory.
- Configuring Postman to utilize the App to connect to Dynamics 365.
So, let’s look at how we do this!
Register an App in Azure
The first step is to register an App in your Azure’s Active Directory so that you can use it to test using your Postman on your machine –
- Go to the Azure Portal (https://portal.azure.com/) and the look for or search for Azure Active Directory
- In AAD, look for App Registrations.
- Now, register a new App in the App Registration
- Enter the details of the App Registration so you can identify what the App is for. Since I’m using this for Postman testing, I’ll enter something like – “Postman WEB API“
Also, since in most cases your Azure environment could be different, it’s recommended to select Accounts in any organizational directory (Multitenant), but it’s up to you based on how you can to secure this!
Since, I’m testing on my local machine using Postman, I’ll enter http://localhost
And finally click on Register.
- Once this is registered, you’ll see the details like any other Azure resource and look for Client ID and copy the same and save it somewhere temporarily.
- Next is updating the Manifest to support this setup.
Set the “allowPublicClient” flag to true and “oauth2AllowImplicitFlow” to true as well.
- Once the Manifest is updated, it should look like this –
- Final step is to give permissions for Dynamics 365 to this App we just created. Go to API Permissions tab from the left-hand menu and click on + Add a permission button.
- Look for the Dynamics CRM option and select it.
- Select it and then click on Add permissions.
- Once added, you’ll need to Grant Permissions. At this moment when it’s not granted, the Status can be seen as blank.
- Select Yes to Grant Permissions.
- Once granted, the Status will be updated as follows – the status of Granted for [OrgName] will appear
- And we are done setting up the App in Azure Portal to be utilized by Postman to test Dynamics 365 Web API locally.
Setting up Postman
Now that we have the App setup, open Postman and we’ll utilize the above created App to establish a connection with Dynamics 365 CRM using OAuth2.0 –
- In your Dynamics 365 CRM environment, capture the OAuth URL in your Customization > Developer Resources section
- Enter this in a new Tab in your Postman and if you directly try to test this, you’ll get 401 Unauthorized.
- Now, we’ll have to configure the Authorization tab to be able to authenticate into Dynamics 365 CRM using the App registration we created in Azure in steps above.
- Now, enter the details we have captured so far –
Token Name – Enter a suitable Token name
Grant Type – Select Implicit if not already set.
Callback URL – The callback URI should be http://localhost based on what we set in Azure in above steps.
Auth URL – Here’s how you can get the Auth URL for your Dynamics 365 environment -> OAuth 2.0 URL for Dynamics 365
Client ID – This should be what you saved above from the Azure App Service. Refer to step #5 in the Setting up App in Azure section above in this post. This should be the Application ID.
Once all this is entered, click on Get New Access Token
- Once you click on Get New Access Token, you’ll need to authenticate into the environment as you usually get while connecting from Browser.
Enter credentials and authenticate.
- Once this connection and the permissions are correctly validated, you’ll get a message like this –
- And it’ll show you this dialog box where you need to simply click on the Use Token button.
- You’ll then see the token as below –
- And you’re set!! Now, you can simply test using Postman.
Testing using Postman
Now that you are authenticated, you can click on Send and see that you are now able to retrieve the Web API
Hope this was helpful! Here are some more Dynamics 365 posts which you might be interested in –
- Dynamics 365 Storage Utilization | Dataverse Storage | Power Platform Admin Center
- Use Hierarchy in Roll Up Fields in Dynamics 365 CRM
- Filter records in a View owned by a Team you are a member of | Dynamics 365 CRM
- Get GUID of the current View in Dynamics 365 CRM JS from ribbon button | Ribbon Workbench
- Dynamics 365 App For Outlook missing on SiteMap in CRM? Use shortcut link [Quick Tip]
- Import lookup referencing records together in Dynamics 365 CRM | [Linking related entity data during Excel Import]
- Mailbox Alerts Hide/Show behavior in Dynamics 365 CRM
- Excel Importing Notes (Annotation) entity in Dynamics 365 CRM
- Enable/Disable the need to Approve Email for Mailboxes in Dynamics 365 CRM CE
- Call Azure Function from Dynamics 365 CRM using Webhooks
- Show Ribbon button only on record selection in Dynamics CRM
- Accessing multiple occurrences of a field in Business Process Flow using JS in D365 CRM