Skip to main content

Notifications

Announcements

No record found.

Customer experience | Sales, Customer Insights,...
Suggested answer

WebAPI Request to filter on modifiedon date and time

Posted on by 10

Hello Community,

I try to request data via WebApi from our CRM System (New/modified entry of the last 15 minutes). The URL looks like this:

https:/url-of-company.com/api/data/v9.2/accounts?$filter=modifiedon%20le%20'2022-02-22T10:51Z'%20and%20modifiedon%20ge%20'2022-02-22T10:36Z'

I retrieve a Server Error 400 - the research I have done and the solutions I found were not quite clear.

Maybe someone can help me out.

Best,

Sven

  • iosven Profile Picture
    iosven 10 on at
    RE: WebAPI Request to filter on modifiedon date and time

    Hi,

    sorry, my fault:

    company-url.dynamics.com/api/data/v9.2/EntityDefinitions?$filter=modifiedon le 2022-02-22T12:26:00.000Z and modifiedon ge 2022-02-22T12:11:00.000Z

    I tried to use it with Visual Studio Code.

    BR,

    Sven

  • Guido Preite Profile Picture
    Guido Preite 54,081 Super User 2024 Season 1 on at
    RE: WebAPI Request to filter on modifiedon date and time

    EntityDefinitions is an endpoint to get the metadata, not actual records.

    Keep in mind that Dataverse REST Builder is available as XrmToolBox tool and if doesn't work inside XrmToolBox you can install it inside your instance as managed solution. inside the repo readme there is a youtube video and a blog post link on how to install and use it.

    Error 400 means bad request, usually means that the url is not written correctly

    hope it helps

  • iosven Profile Picture
    iosven 10 on at
    RE: WebAPI Request to filter on modifiedon date and time

    Hello Guido,

    thanks for you reply, but the error 400 still persists.

    My URL looks now like this: company-url.dynamics.com/.../EntityDefinitions

    I tried using Datavers REST Builder, but I was not able to get a connection to the Dataverse even if it looks like a  connection was established once.

    Thanks and all the best,

    Sven

  • Suggested answer
    Guido Preite Profile Picture
    Guido Preite 54,081 Super User 2024 Season 1 on at
    RE: WebAPI Request to filter on modifiedon date and time

    the datetime operators you are using don't need the single quote (') before and after the value, also the time value is not the one you usually receive (but should work) so your url should look like this one:

    https:/url-of-company.com/api/data/v9.2/accounts?$filter=modifiedon%20le%202022-02-22T10:51:00.000Z%20and%20modifiedon%20ge%202022-02-22T10:36:00.000Z

    if you need to build and test such queries you can use Dataverse REST Builder (you can find the link inside my signature)

    hope it helps

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!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 230,235 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans