web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Pages / Querying Data with Web...
Power Pages
Answered

Querying Data with Web API and Filter on Dates

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

Hello, 

 

I am referring to this document Query data using Portals Web API and I don't see an option to filter on dates. Is it still possible to filter on date using Portals Web API? If not, any way I can dynamically add filters to fetchxml for instance, if I don't know before hand how many date filters I'd need in fetchxml?

 

Thank you so much in advance!!

Categories:
I have the same question (0)
  • OOlashyn Profile Picture
    3,496 Most Valuable Professional on at

    Hi @Anonymous ,

    Web API supports filtering. You can use $filter option to specify your filter the same way as with regular Dataverse api. It is described in the article you mention.

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Thank you for your response @OOlashyn

     

    I am not able to use filter on dates using Portals Web API. I tried all ways to filter with dates.

    "/_api/cred7_claims?$select=cred7_type,cred7_controlnumber,cred7_contact&$filter=cred7_incidentdateandtime ge datetime'"+ 2021-02-18T20:11:00 + "'"
    "/_api/cred7_claims?$select=cred7_type,cred7_controlnumber,cred7_contact&$filter=cred7_incidentdateandtime ge '"+ 2021-02-18 + "'"
    "/_api/cred7_claims?$select=cred7_type,cred7_controlnumber,cred7_contact&$filter=cred7_incidentdateandtime ge '"+ 2021-02-18T20:11:00 + "'"

    I have test filtering on other data types and it has worked. Date is the only data type that's not working for me.

     

    Any suggestions would be greatly appreciated! 

     

    Thank you!

  • ragavanrajan Profile Picture
    7,044 Most Valuable Professional on at

    Hi @Anonymous 

     

    I presume maybe it is not there yet. Below is the snippet from dataverse API . I think it is applicable for Portal Web API. 

     

    ragavanrajan_0-1639439365884.png

    Hope it helps. 
    ------------

    If you like this post, give it a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users to find it.

  • Verified answer
    OOlashyn Profile Picture
    3,496 Most Valuable Professional on at

    Hi @Anonymous ,

    I just checked and filtering works just fine with dates. Can you show me how exactly you are performing the request? Do you receive any errors in response? Also, can you create your query in Fetchxml Builder in Xrmtoolbox and validate that it works there? My guess is that there is something wrong with the request itself ie can you filter only on a date without the time and check if that helps.

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Thank you @ragavanrajan and @OOlashyn for your responses! 

    @OOlashyn's solution worked for me! Thank you for trying it out, I removed the time and it worked perfectly.

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Leaderboard > Power Pages

#1
Fubar Profile Picture

Fubar 26 Super User 2026 Season 1

#2
Lucas001 Profile Picture

Lucas001 19 Super User 2026 Season 1

#3
CN-06091549-0 Profile Picture

CN-06091549-0 18

Last 30 days Overall leaderboard