exact-online

Why am I getting XML results from the Exact Online API where I used to get JSON results?


Just started working on an existing project making use of the Exact Online API.

While I was debugging the project I suddenly only started receiving XML results instead of JSON results from the API. I did not change anything about the endpoints being queried I was just running the existing queries trying to figure some things out.

These are the REST API docs: https://start.exactonline.nl/docs/HlpRestAPIResources.aspx These are the XML docs: https://support.exactonline.com/community/s/knowledge-base#All-All-DNO-Content-xmlsamplecode

Typical REST API endpoints look like this: https://start.exactonline.be/api/v1/xxxxxx/salesinvoice/SalesInvoices

Typical XML endpoints look like this: https://start.exactonline.be/docs/XMLDownload.aspx

I also did not change any settings. I only have access to the tokens and api. I don't have access to the account.

This is an example of an endpoint and query where I previously received JSON but am now receiving XML: https://start.exactonline.be/api/v1/xxxxxx/salesinvoice/SalesInvoices?$filter=InvoiceID eq guid'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxx'&$select=InvoiceID

I tried this manually with Postman and also using the existing code from the project.

Is there some setting I am unaware of? Am i querying the wrong way? Maybe there have been some changes to the API I am unaware of that aren't listed in the release notes?


Solution

  • Please provide the request header Accept in your HTTP request that specifies what content format you prefer to receive: application/json. The default of Exact Online APIs is XML (but seldom to never used).