Help including a date specification in REST API URL

460
2
Jump to solution
05-16-2022 08:38 AM
jdjohn215
New Contributor

Until last week, I was regularly querying this MapServer with a URL that specified minimum date. Sometime last week, I started getting error code 400.

My now-failing URL looks like this: https://dhsgis.wi.gov/server/rest/services/DHS_COVID19/COVID19_WI_V2/MapServer/11/query?where=RptDt>='2022-05-01'&outFields=*&returnGeometry=false&outSR=4326&f=json

The key bit is where=RptDt>='2022-05-01'.

This URL, without the date argument, works just fine, so this isn't an issue with the server itself.

https://dhsgis.wi.gov/server/rest/services/DHS_COVID19/COVID19_WI_V2/MapServer/11/query?where=1%3D1&outFields=*&returnGeometry=false&outSR=4326&f=json 

Did ArcGIS change the formatting for date values? Does anyone know how I can update my URL to work properly?

0 Kudos
1 Solution

Accepted Solutions
jcarlson
MVP Esteemed Contributor

Try using something like timestamp '2022-05-01'. We encountered this with a server upgrade in the past, where the word "timestamp" was previously not required, which broke some of our queries.

- Josh Carlson
Kendall County GIS

View solution in original post

2 Replies
jcarlson
MVP Esteemed Contributor

Try using something like timestamp '2022-05-01'. We encountered this with a server upgrade in the past, where the word "timestamp" was previously not required, which broke some of our queries.

- Josh Carlson
Kendall County GIS
jdjohn215
New Contributor

Bingo. This works:

https://dhsgis.wi.gov/server/rest/services/DHS_COVID19/COVID19_WI_V2/MapServer/11/query?where=RptDt>=timestamp'2022-05-01'&outFields=*&returnGeometry=false&outSR=4326&f=json 

 

Thanks, Josh!

0 Kudos