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

Notifications

Announcements

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

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
    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
    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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Pages

#1
Fubar Profile Picture

Fubar 89 Super User 2025 Season 2

#2
Jerry-IN Profile Picture

Jerry-IN 75

#3
sannavajjala87 Profile Picture

sannavajjala87 31

Last 30 days Overall leaderboard