Welcome to Community Week 2025! Join us to learn, connect, and be recognized as we celebrate the spirit of Community and the power of AI. Get the details  

REST API get only records updated after certain time

Amey4
Kilo Explorer

How to write write an API call to get records updated after certain date/time? For example

https://tesla.service-now.com/api/now/table/incident?sysparm_query=sys_updated_on>"2018-06-01"

 

 

 

3 REPLIES 3

Abhinay Erra
Giga Sage

You can OOB table api . You can also create  a scripted rest api and pass a parameter for the date/time. You can then do the gliderecord query for the records updated after that date/time and pass that in the response object

Amey4
Kilo Explorer

I think i'm already using Out of box incident table api but couldn't find a way to run greater than date query. Can you please elaborate more on scripted rest api approach? I didn't get that. 

 

Thanks for your help. 

Simon Christens
Kilo Sage
This should work

var request = new sn_ws.RESTMessageV2(); request.setEndpoint('https://instance.service-now.com/api/now/table/incident?sysparm_query=sys_created_on%3Ejavascript%3Ags.dateGenerate('2018-01-01'%2C'00%3A00%3A00')); request.setHttpMethod('GET');

you can use REST API Explorer (search for that in the navigator)
There you can play around with div REST API's

Query is copied from a list of incidents with created on after a date that includes HH:mm:ss
sys_created_on>javascript:gs.dateGenerate('2018-01-01', '00:00:00')