Skip to main content

Notifications

Announcements

No record found.

Configure Postman to access data from Dynamics 365 F&O

Working with Dynamics 365 F&O is nothing but working with data. And this data can be written to FO tables from FO UI or from 3rd part software using API exposed from FO. For configuring an API which sends or receives data, we have various approaches which we will speak in coming articles. But for unit testing of a such API, we generally use a postman. Let us understand how we can configure the postman. Postman in its simpler terms helps us develop API in a better way.

Prerequisites:
  1. Azure Portal App Registration
  2. External application Registration in FO
The above steps are taken care in my older article. Link is added here - Link.

From the App registration, we will get the below details
  1. Directory ID (Tenant ID)
  2. Client ID (Application ID)
  3. Client Secret ID
Now let us understand the Postman Configuration.

Postman Configuration:
  1.  Download and install latest Postman application from the link https://www.postman.com/downloads/.
  2.  Create a new collection for ordering the requests in a meaningful way.
  3.  Create new environment and add the mentioned variables. An environment in Postman is similar to a class in any programming language which is used to store Variables.
  4.  Make sure the collection which we have created is under the related environment which can be found from top right of the screen. It should show correct environment name.
  5.  We generally will have multiple APIs to work with and it is not required to create access tokens separately. Access Token serves as a credential, which allows the user or an application to gain access to any protected resource based on their permissions. The above listed variables are for generating access token. 
  6.  Now add a http POST request under the new collection created. Under Body tab, add the parameters in Key Value pair as shown below. Resource is the URL of FO from which we are expecting some response.
  7.  On successful addition of all the said details, we can receive a success response of '200 OK' and we receive an access token as shown above.
  8.  Thing is for every call to FO; we need to use this access token. We can copy this value and paste it but in a better way we can use below code which can create a variable if not there and assigns the value directly. Means we are creating again a new global variable since this access token is used for different API calls with same resource. This can be added under Scripts > Post-response. 
           Code: pm.environment.set('access_token',pm.response.json().access_token);

This is the configuration of Postman which is to be done so that our Postman will be ready to add any new API for testing.


Happy Learning!

Comments