API ODATA $filter DateTime "gt" DateTime returns the "eq" doc

I want to use the "gt" $filter with a DateTime on DATE_UPDATED_UTC for Opportunities to start returning docs after the previous most recent one. When I use something like DateTime'2018-01-04T21:17:22', I get a doc with that DATE_UPDATED_UTC like I would expect for "ge" but not for "gt".

GET /v2.1/opportunities?%24filter=DATE_UPDATED_UTC+ge+DateTime%272018-01-04T21%3A17%3A22%27&%24orderby=DATE_UPDATED_UTC+asc&%24top=1

The "gt" should only return docs actually greater than the supplied date.

0

Comments

1 comment
  • Official comment

    Hi Robert,

    I checked your case and you are right, gt filter works like ge for DateTime fields.
    It works fine with other data types.

    On the other hand, we do not have specific development about ODATA filters and I think the problem is related to OData specs. We support OData v4.0 with API v2.1.

    I suggest you to implement a workaround like subtracting one second from your target date before you run the gt filter query.

    Thanks,
    Oguzhan

    Comment actions Permalink

Please sign in to leave a comment.