REST API GET using greater than for Dates

sobhan
Kilo Explorer

How to build a GET Rest query to fetch Incidents created after specific date.

https://my.service-now.com/api/now/table/incident?sysparm_query=sys_created_on > "2015-05-05 00:00:00"

i Need like above, what's the right query request, can you help me ?

1 ACCEPTED SOLUTION

Brad Tilton
ServiceNow Employee
ServiceNow Employee

Hi Sobhan,



This is a circumstance where you can build the query with the filter and then copy the query. Try something more like this for your query:



https://my.service-now.com/api/now/table/incident?sysparm_query=sys_created_on>javascript:gs.dateGenerate('2015-01-01','23:59:59')



Encoded Query Strings - ServiceNow Wiki



b0e73069a3.png


View solution in original post

3 REPLIES 3

Brad Tilton
ServiceNow Employee
ServiceNow Employee

Hi Sobhan,



This is a circumstance where you can build the query with the filter and then copy the query. Try something more like this for your query:



https://my.service-now.com/api/now/table/incident?sysparm_query=sys_created_on>javascript:gs.dateGenerate('2015-01-01','23:59:59')



Encoded Query Strings - ServiceNow Wiki



b0e73069a3.png


JulianLeite
Tera Contributor

Hi Brad,
I want to send a API call to ServiceNow to incident table to get data using: 

sys_created_on >= 'My_DATE' and sys_created_on < 'My_Date'
 
The version I'm using is San Diego
 
Thanks

Hi @Brad Tilton 

 

i apply filter date on rest api  "now.com/api/now/table/incident?sysparm_query=sys_created_on>%3Djavascript&colon;gs.dateGenerate(%272023-01-01%27%2C%2700:00:00%27)"

iam getting only 9 month records , iam not getting 2024 records, can you help me on this