Date range Query with the rest api.

jwdub
Kilo Explorer

I have seen various question like this and the code I am using is directly from gs.dateGenerate using specific times between yesterday and today

However when ever I run the following curl request it returns all incidents from the beginning of time up to the max of 10K

"https://myhost.com/api/now/v1/table/incident?sys_created_onBETWEENjavascript:gs.dateGenerate(gs.begi..."

Has anyone any ideas why this may be the case?

James

1 ACCEPTED SOLUTION
4 REPLIES 4

drjohnchun
Tera Guru

Hi James - I provided the "correct answer" to the post you're referencing. According to the OP, David, he had to swap the two dates to make it work; please see that post for the details towards the bottom. Can you try that and see if it'll resolve your issue?



Please feel free to connect, follow, mark helpful / answer, like, endorse.


John Chun, PhD PMP see John's LinkedIn profile


visit snowaid


Hi



Ok I have changed it now to be



  "https://myhost.com/api/now/v1/table/incident?sys_created_onBETWEENjavascript:gs.dateGenerate(gs.begi..."



And I get the same results. Even leaving the issue of the date range aside for a moment. why do I continually just get back every ticket ever raised from the earliest onwards.   Surely that is weird behaviour.


You were missing "sysparm_query="; please see below for the revised link:



https://instance.service-now.com/api/now/v1/table/incident?sysparm_query=sys_created_onBETWEENjavasc...


Hi



That works fine now.



James