exact-online

Exact online - bad request 400


Im trying to call the api but I get the bad reuqest 400 response.

accoring to documenation this could be because of syntax error:

This error occurs when the request could not be understood by the server due to malformed syntax. The client should not repeat the request without modifications.

My endpoint

"https://start.exactonline.be/api/v1/850750/read/financial/AgingOverview?$select=AgeGroup,AgeGroupDescription,AmountPayable,AmountReceivable,CurrencyCode",

"https://start.exactonline.be/api/v1/850750/read/financial/AgingOverviewByAccount?$select=AgeGroup,AgeGroupDescription,AmountPayable,AmountReceivable,CurrencyCode",

First endpoint works, second throws the syntrax error.


Solution

  • You are trying to get the AgingOverviewByAccount, without supplying an account ID. The AgingOverview endpoint gets an overview of your suppliers/customers.

    See: https://start.exactonline.nl/docs/HlpRestAPIResourcesDetails.aspx?name=ReadFinancialAgingOverview

    The AgingOverviewByAccount does this but for specific account. Therefore, you need to supply the endpoint with an accountID as such:

    /api/v1/{division}/read/financial/AgingOverviewByAccount?accountId=guid'00000000-0000-0000-0000-000000000000'&$select=AgeGroup,AgeGroupDescription,AmountPayable,AmountReceivable,CurrencyCode
    

    And a bad request error is thrown when you don't supply an accountId, as the server does not know from what account you are requesting the Aging Overview.