Making Microsoft Dataverse OData queries using Postman

Once you have registered your application and have your ClientId and ClientSecret you can use these to authenticate using oauth2 client credentials workflow.

Environment

Create an appropriate Postman environment with the following variables:

url - https://<yourcompanyname>.crm4.dynamics.com
clientid - <your clientid>
clientsecret - <your clientsecret>
version - 9.1
webapiurl - {{url}}/api/data/v{{version}}
tenantid - <guid>
authurl - https://login.microsoftonline.com/{{tenantid}}/oauth2/v2.0/token

Collection Authorization

Setup Authorization for your Postman Collection so all the calls within will inherit it and use the token.

  • Set the Type to "OAuth 2.0"
  • Add auth data to "Request Headers"
  • Configure New Token
  • Token Name - "MyToken"
  • Grant Type - "Client Credentials"
  • Access Token URL -  "{{authurl}}"
  • Client ID - "{{clientid}}"
  • Client Secret - "{{clientsecret}}"
  • Scope - "{{url}}/.default"
  • Client Authentication - "Send as Basic Auth header"
Click "Get New Access Token".
You should then get a pop-up with the message "Authentication complete" and then you can see the response and choose to use the token.

Then you should be able to create your requests which will use this token.
Example request to get 3 accounts
GET {{webapiurl}}/accounts?$top=3

Here's how to form your OData requests
https://docs.microsoft.com/en-us/powerapps/developer/data-platform/webapi/query-data-web-api


Comments

Popular posts from this blog

Windows 7 - Cisco VPN Client

Enabling SNMP on an ASUS RT-N66U