Adding modified date range to gis.content.search

998
1
Jump to solution
08-17-2020 01:21 PM
AndrewThompson2
New Contributor II

Hi,

I am trying to add a date modified range query to this API call below:

search_result = gis.content.search(query=modified:DATERANGE, item_type="Feature Service", sort_field="modified", sort_order="desc", max_items=5000)

I have tested the query="title:NAMEOFLAYER" and it works fine. But I cant get the right syntax for the query=modified:

I have tried the above syntax, plus these: query="modified [1577840400 TO 1609455600]", query=modified 1577840400 TO 1609455600, query='modified [1577840400 TO 1609455600]'

I cant find any examples of the right syntax for this to work.

Thanks for any help in advance.

Andrew

0 Kudos
1 Solution

Accepted Solutions
MehdiPira1
Esri Contributor

Hi Andrew Thompson‌,

You are just missing 3 zeros in front of the UNIX times and also double quotation marks.

Your code has to be as follows:

search_result = gis.content.search(query="modified:[1577840400000 TO 1609455600000]", item_type="Feature Service", sort_field="modified", sort_order="desc", max_items=5000)‍‍‍‍

View solution in original post

1 Reply
MehdiPira1
Esri Contributor

Hi Andrew Thompson‌,

You are just missing 3 zeros in front of the UNIX times and also double quotation marks.

Your code has to be as follows:

search_result = gis.content.search(query="modified:[1577840400000 TO 1609455600000]", item_type="Feature Service", sort_field="modified", sort_order="desc", max_items=5000)‍‍‍‍