How to call AX data entity from Postman

Here in this post I give hints about how to register an application in Azure Active Directory, set the application access in AX and then how to call AX data entity from Postman

Register an application and give the necessary API Permissions

Based on the information found in the following Microsoft docs, and with the support of our IT manager, I made the setup.

https://docs.microsoft.com/en-us/azure/active-directory/develop/v1-oauth2-client-creds-grant-flow#client-credentials-grant-flow-diagram


https://docs.microsoft.com/en-us/azure/active-directory/develop/quickstart-register-app


https://docs.microsoft.com/en-us/dynamics365/supply-chain/warehousing/install-configure-warehousing-app#create-a-web-service-application-in-azure-active-directory

Azure App registration screens

Azure Active Directory App registration
AAD App registration – Authentication
AAD App registration – API permissions
AAD App registration – Certificates and secrets

AX

Go to ‘System administration / Azure Active Directory applications ‘

D365FO Azure Active Directory applications
D365FO New AAD application

In Postman

I am using the developer VM that can be downloaded from LCS site (Lifecycle Services), I have installed Postman on this DEV VM and my URL is ’https://usnconeboxax1aos.cloud.onebox.dynamics.com’. I will call data entities like for example the Vendors for which the URL is ’https://usnconeboxax1aos.cloud.onebox.dynamics.com/data/Vendors’.

To prevent getting the following SSL error, you need to modify one setting of Postman.

The typical Postman SSL error

“Could not get any response

There was an error connecting to https://usnconeboxax1aos.cloud.onebox.dynamics.com/data/Vendors.

Why this might have happened:

               • The server couldn’t send a response:

Ensure that the backend is working properly

               • Self-signed SSL certificates are being blocked:

Fix this by turning off ‘SSL certificate verification’ in Settings > General

               • Proxy configured incorrectly

Ensure that proxy is configured correctly in Settings > Proxy

               • Request timeout:

Change request timeout in Settings > General”

Go to Settings and turn off SSL certificate verification,

Postman settings
Postman settings – SSL certificate verification

Environment variable setup

Postman – manage environments
Postman – manage environments 2

Get the access token

To get the access token, set up the following in Postman and click send:

POST – https://login.microsoftonline.com/{{adId}}/oauth2/token

Postman – get access token 1

After clicking send you should see something like this (don’t forget to turn SSL verification off as I described above):

Postman – get access token 2

Copy the access token and update the ‘authCode’ variable with this long string. Remember that the token has an expiry, so you need to update it later. You could have a look at the values coded in the token (for example the expiry date) if you went to ’jwt.io’. Paste the text into the ’Encoded’ textbox. Move your mouse over the values on the right in the ’Decoded’ box and you will get a readable value.

JWT.IO – Token decoded

Access the data entity from Postman

After this many setups, you can call https://usnconeboxax1aos.cloud.onebox.dynamics.com/data/Vendors by creating a get type request like on the screenshot below.

How to call AX data entity from Postman – Header

Or without using variable, you can paste the token directly to the ’Authorization’ value box after ’Bearer’ and a space. Click ’send’ and see the result:

How to call AX data entity from Postman – Result

You can add a filter parameter for example:

How to call AX data entity from Postman – Filter

Leave a Reply

Your email address will not be published. Required fields are marked *