I am trying to make a REST API call to fetch the list of pages published before a given date and time:

//_api/search/query?querytext='Path:http:sharepointpath owstaxIdTaxKeyword:81394a-cedb-4c19
 (StoryDate<=2016-12-19)'&rowlimit=5& selectproperties='Title'&enablequeryrules=false

The StoryDate has values like 2015-11-19T08:00:00Z.

I also tried StoryDate<2016-12-19T08:00:00Z, which didn't work. Whereas StoryDate:2016-12-19T08:00:00Z works.

Now the problem is how do I do a less than or equal to in this case given that the values I have are in date format?

  • try using the lt (less-than) operator instead of < – user2536 Nov 24 '15 at 11:02
  • yeah i tried that too storydate lt 2016-12-19 – Vignesh Subramanian Nov 24 '15 at 11:04
  • 1900-01-01T00:00:00 – user13408 Nov 24 '15 at 11:32

Make sure the field name you are using is defined in the Managed Properties in the Search Schema...

| improve this answer | |
  • thanks I was using the internal column name. When I used the managed properties name it worked fine – Vignesh Subramanian Nov 24 '15 at 12:30

try using the below query:

/_api/web/lists/getbytitle('StoryDate')/Items?$filter=Created leq '11/24/2015'

Found this amazing tool for Search Queries : https://sp2013searchtool.codeplex.com/

| improve this answer | |
  • can i add filter for api search query? – Vignesh Subramanian Nov 24 '15 at 11:10
  • Is there leq??I know Lt,Le,Eq,Ne – user13408 Nov 24 '15 at 11:34
  • 2
    OP's question is regarding search API (_api/search/query?querytext) not regarding List (/_api/web/lists) – Atish Dipongkor - MVP Nov 24 '15 at 11:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.