Making A Call To Retail Server APIs

This article will talk about how to make a call to a Retail API and what information is required to get the response.
 
As a first step, I generated the access token using username-password flow and obviously the client id as shown in the below image:
 
Making A Call To Retail Server APIs
 
Then I tried to make a call to an API using Postman as shown below:
 
Making A Call To Retail Server APIs
 
And here is the 401 Unauthorized error ☹ with a reason - Microsoft_Dynamics_Commerce_Runtime_DeviceTokenNotPresent
 
After spending hours, I got to know that Retail APIs (non anonymous) can’t be called just by passing the access token. In order to make an API call successful, there is one additional information ‘devicetoken’, which needs to be sent. Now where to pass this information?
 
Well, fortunately I was able to figure it out. This ‘devicetoken’ has to be passed as a header while making the API call as shown below:
 
Making A Call To Retail Server APIs
 
Once the device token is passed, you will get the expected response from the API. 
 
Enjoy troubleshooting!


Similar Articles