rest api date range query params

chamarts
Kilo Explorer

Hi,

how do I query the rest api for incidents between date range ?   I used /incident?start=&end= but this doesn't see to work. It fetches all the records from beginning with 10,000 per page.

I am using chrome advanced rest client to query the api. any help is greatly appreciated

thx

sri

1 REPLY 1

Thijs Daemen
Mega Guru

Hi Srinivas,



you can use the default way of getting the encoded query from the system.


  • go to the list of records
  • assemble the filter
  • right click on it -> copy query


Use the query in your REST API call for the sysparm_query parameter



Example:


https://<instance>.service-now.com/api/now/table/incident?sysparm_query=opened_atBETWEENjavascript%3Ags.dateGenerate('2015-12-06'%2C'00%3A00%3A00')%40javascript%3Ags.dateGenerate('2016-03-02'%2C'23%3A59%3A59')



Of course you can use the REST API Explorer to test these calls.



REST API Explorer - ServiceNow Wiki