Skip to main content

Notifications

Small and medium business | Business Central, N...
Answered

API: Format error in $filter of agedAccountPayables by agedAsOfDate

Posted on by 13
Hi,
 
I'm getting a strange error trying to $filter `agedAccountsPayables` (or Receivables) by `agedAsOfDate` as it always tells me the format of the date is wrong.  The exact same format of $filter works for e.g. `purchaseOrders` by `orderDate`.
 
Is this a bug in the API, or something I am misunderstanding?
 
Examples using the Cronus sample database (with some manual word-wrapping for clarity:
 
GET https:/api.businesscentral.dynamics.com/v2.0/{{tenant}}/production/api/v2.0/agedAccountsPayables?company=CRONUS UK Ltd.&$filter=agedAsOfDate ge 2024-02-01
{
  /error/: {
    /code/: /Application_EvaluateException/,
    /message/: /The format of the Date '>=02/01/24' does not match your device's date settings.//r///r/Make sure that the day, month, and year are in the correct order and use the correct separator (such as - or /). Alternatively, you can always use the format 'yyyy-mm-dd'.  CorrelationId:  b750524a-573b-475f-bdbf-6c85024937be./
  }
}
 
GET https:/api.businesscentral.dynamics.com/v2.0/{{tenant}}/production/api/v2.0/purchaseOrders?company=CRONUS UK Ltd.&$filter=orderDate gt 2024-04-08
{
  /@odata.context/: https:/api.businesscentral.dynamics.com/v2.0/070927bf-7189-4b3c-99b5-60f306d9b138/production/api/v2.0/$metadata#purchaseOrders/,
  /value/: [...results...]
}
 
 
You can see that I am indeed sending in yyyy-mm-dd format that it says you can always use, but the error suggests it has internally been converted to US format dates (and my tenant is a UK one).
 
Very strange that it works for purchaseOrders, but not for agedAccountsPayables.
 
Any suggestions would be much appreciated!
 
 
 
Categories:
  • Verified answer
    RT-01051226-0 Profile Picture
    RT-01051226-0 13 on at
    API: Format error in $filter of agedAccountPayables by agedAsOfDate
    Worked out my mistake - agedAsOfDate should of course use an `eq` not `gt`.  The error message made no sense, but the error was using the wrong operator in the $filter.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Community AMA December 12th

Join us as we continue to demystify the Dynamics 365 Contact Center

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,240 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,149 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans