Tuesday, June 11, 2019

Testing custom services with POSTMAN

Create a POST type entry and enter below in the search bar.

{{resource}}/api/services/<Service Group>/<Service>/<ServiceMethod>

Testing Custom entities in D365FO using POSTMAN scripts

There is a really good article from Microsoft to configure the POSTMAN to test the custom services in D365FO. However there are some small changes here and there that could help you configure the POSTMAN to work better with D365FO.

Few more links below to understand how POSTMAN scripts can be manipulated to fetch the correct results.

vishwad365fo.blogspot.com/2018/05/custom-service-to-create-sales-order.html

axtoday.blogspot.com/2017/08/accessing-dynamics-365-for-operations_17.html


For me even after following the article from Microsoft I was getting error so I did below changes.

After we have generated the Bearer Token and it is added to your environment. Just go to the Authorization tab and select Bearer Token on the Type field. Also copy and paste the Bearer token to the token field.


On the header tab write below values

Authorization:Bearer{{bearerToken}}
Content-Type:application/json



Body tab must select Raw and select JSON from the drop down.



On the Tests Tab put the following JSON script.

var json = JSON.parse(responseBody);
tests["Get  info"] = !json.error && responseBody !== '' && responseBody !== '{}';