How to use POSTMAN to access D365FO Odata endpoint
Time needed: 10 minutes.
Steps
- Start Postman -> manage environments
Select Manage environments to create or update an environment.
Enter a name for the environment, and then select Bulk Edit - Bulk edit
Enter key-value pairs as shown in the below image. Enter one pair per line, and separate the key and value by using a colon (:)
Following things need to be added
a) tenant_id – Check under azure active directory to Azure portal
b) client_id – created during app registration on Azure active directory
c) client_secret – created in certificate & secrets section
d) grant_type – enter value as client_credentials
e) resource – enter D365FO environment URL (note it should not end with /)
- New POST request
URL –https://login.microsoftonline.com/:tenant_id/
oauth2/token
Enter Environment keys shown in the below image to get access token which will be used in the Odata query authentication. - Go to Tests Tab
On the Tests tab, create a test that validates that the response is reasonable, and then stores the returned authorization token in an environment variable named bearerToken
——————————————————————————-
var json = JSON.parse(responseBody);
tests[“Get Azure AD Token”] = !json.error && responseBody !== ” && responseBody !== ‘{}’ && json.access_token !== ”;
postman.setEnvironmentVariable(“bearerToken”, json.access_token);
—————————————————————————– - New GET request
URL – https://YourD365URL.com/data/EntityNameWe need to create Authorization key in header whose value will be ‘Bearer {{bearerToken}}’
We have used the environment variable created in the previous step to store the token value.
Hit the send button and voila you have the GET response from the D365FO environment.
I hope this article helped you learn how to use POSTMAN to access D365FO Odata endpoint in D365 Finance & operations AX. Don’t forget to share this article. You may also want to see our article on How to do string left or right padding in X++. You can follow us on facebook for more tips and tricks.
Comments: 10
Amazing blog.. Very well written
Thank you so much 🙂
Very nice blog and simple explanation, thank you.
just to add if no data returned then you can add cross-company=true parameter in request as in my case default was set as “DAT”
I was able to generate the token successfully but while consuming Odata it is giving 401(Unauthorized) error even though i have registered the application in D365
I was facing the same issue but fortunately
I found this one https://www.youtube.com/watch?v=Eri9PfxrCDQ
I have the same problem good token, but error 401 when consuming Odata.
I have registered the application in D365FO ActiveDiectory parameters, for and Admin User.
And register on Azure portal permissions for Microsoft API after select Dynamics ERP and delegated permission permissions, for AX, CustomService, Odata..
Is there an authorization to dataserve for the dataEntity?
I checked the logs in the VM, nothing. No activity is happening.
With fidler2.com to explore http exchange i have this error :
under RFC2616, HTTP/401 reponse will not be cached regardless of what caching headers may be present.
etc…
My reference :
https://docs.microsoft.com/en-us/dynamics365/fin-ops-core/dev-itpro/data-entities/third-party-service-test
https://docs.microsoft.com/en-us/azure/active-directory/develop/quickstart-register-app
I’m puzzled. What is “Get Azure AD Token”
Ho do I get the main requests to call the request to get a new access token
All the setup done but hit the error: “error_description”: “AADSTS500011: The resource principal named https://*.com was not found in the tenant named Dell Technologies. This can happen if the application has not been installed by the administrator of the tenant or consented to by any user in the tenant. You might have sent your authentication request to the wrong tenant.\r\nTrace ID: 72f31c6c-44af-4ca6-9649-0ab8e1053e00\r\nCorrelation ID: 6745f854-a554-4eed-9b92-2a95da5b7068\r\nTimestamp: 2022-08-31 09:01:53Z”.
Why do I get Error: unable to verify the first certificate when I try to send post request to my vm deployed FinOps solution e.g. https://ffff.cloud.onebox.dynamics.com/data/CustomersV2
Can I able to do the actions related to account payable and receivable in d365 finance.