put conditions inside URL

Muhamad Fahrurrozi 41 Reputation points
2022-12-07T05:18:06.19+00:00

Dear All,

I'm wondering for the possibility to put a condition "If the Date of Items equal and or bigger than Today, then show the Items" inside this URL?

url: listEndPoint+"/GetByTitle('Info')/Items?$select=*&$filter=substringof('"+ filter +"',Title)&$orderby=Created desc"  

SharePoint List scenario using Date and Time:

Column Name --- Type of Column

  1. startDate --- Date and Time
  2. endDate --- Date and Time

Thank you

SharePoint Development
SharePoint Development
SharePoint: A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.Development: The process of researching, productizing, and refining new or existing technologies.
2,691 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Tong Zhang_MSFT 9,116 Reputation points
    2022-12-08T06:23:24.423+00:00

    Hi @Muhamad Fahrurrozi ,

    According to my research and testing, you can refer to the following API to filter items with dates greater than or equal to a certain day (filter date):

    _api/web/lists/GetByTitle('aaaa')/Items?$select=*&$filter=(startDate ge datetime'2022-12-08T00%3a00%3a00')  
    

    Similar issue for reference: REST API filter by start and end dates using 'today'

    Hope it can help you. Thanks for your understanding.

    Note: Microsoft is providing this information as a convenience to you. The sites are not controlled by Microsoft. Microsoft cannot make any representations regarding the quality, safety, or suitability of any software or information found there. Please make sure that you completely understand the risk before retrieving any suggestions from the above link.


    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.