Query REST API to find Incident which were updated in last 7 days
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
I need to create a query that find Incidents that were updated in the last 7 days in using the rest API.
The documentation doesn't show how to do that. but when i use the UI i see a batch controller being used and passing something like:
How do i construct the query programmatically against the rest API?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hello @eyal_nscale ,
In servicenow there is OOTB module rest api explorer , first run your query on incident table filter then copy that query from that and paste in rest api explorer sysparm_query . mentioning some screenshots .
If this helps you mark it as helpful and accept as solution.
Regards ,
Aditya
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2 weeks ago
Hello @eyal_nscale ,
If above answer helps you then mark it as helpful and accept as solution.
Regards,
Aditya
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
You construct the query by putting an encoded query string into the sysparm_query parameter,
for example:
/api/now/table/incident?sysparm_query=sys_updated_on>=javascript:gs.daysAgoStart(7)
Mark it helpful if this helps you to understand. Accept solution if this give you the answer you're looking for.
Thank You