Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

How to fetch data between two different days in Service-now Table API ?

anuruddha banda
Kilo Contributor

I need to fetch Incident records using service now Table API. But i need to fetch data in between two different dates?  

Ex: Incidents records which are created between "2022-03-19 00:00:00 and 2022-03-20 00:00:00"

 

Here is the URL which i used to fetch data. But this return me all the record which are created before "2022-03-20 00:00:00" not the rerecords which are done between "022-03-19 00:00:00 and 2022-03-20 00:00:00".

URL: https://dev59251.service-now.com/api/now/table/incident?sysparm_query=2022-03-19 00:00:00>sys_created_on<2022-03-20 00:00:00

Method: GET

Params:
       sysparm_query=2022-03-19 00:00:00>sys_created_on<2022-03-20 00:00:00
1 ACCEPTED SOLUTION

Community Alums
Not applicable

Hi @anuruddha bandara ,

I always recommend utilizing the REST API explorer combined with list queries.

When you build the query you are looking for in a list, you can right click it to copy the query.

Screen Shot 2016-11-29 at 2.53.02 PM.png

 

Then paste that query into the API explorer GET query field,

 

Screen Shot 2016-11-29 at 2.53.24 PM.png

Finally, ensure you are sending the right basic auth credentials.

Mark my answer correct & Helpful, if Applicable.

Thanks,

Sandeep

View solution in original post

1 REPLY 1

Community Alums
Not applicable

Hi @anuruddha bandara ,

I always recommend utilizing the REST API explorer combined with list queries.

When you build the query you are looking for in a list, you can right click it to copy the query.

Screen Shot 2016-11-29 at 2.53.02 PM.png

 

Then paste that query into the API explorer GET query field,

 

Screen Shot 2016-11-29 at 2.53.24 PM.png

Finally, ensure you are sending the right basic auth credentials.

Mark my answer correct & Helpful, if Applicable.

Thanks,

Sandeep