I am using Postman to query a Dynamics 365 Business Central (BC) API. The API is returning XML and I am trying to get it to return JSON. The Microsoft page that gives an example shows the response as being in JSON format.
I tried added my own Request header to denote that I would like JSON returned
Postman says that by adding my own "Accept" Request header it will override the one that is auto-generated
Even so I tried sending the request with the auto-generated "Accept" header disabled and enabled. This is the response ...
Am I requesting JSON the proper way for a REST endpoint? Microsoft's example seems to indicate that JSON can be returned yet I am only able to get XML back as shown below (just a fragment)
There are two different endpoints you are talking about, $metadata
which generates the whole CSDL schema in xml format, whereas <endpoint>/companies
fetches the data in JSON format.
This can be tested in browser simply pasting these URLs.
https://api.businesscentral.dynamics.com/v2.0/environment name/api/v2.0/$metadata
https://api.businesscentral.dynamics.com/v2.0/environment name/api/v2.0/companies
Note: Pls test it. I don’t have experience with Dynamics BC, but I managed to get these from docs with the idea of my Dynamics CRM experience :)