- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-25-2015 05:10 AM
I have few questions, It would be great if someone could answer them.
- How to fetch the incidents sorted by time?
- One REST API query returns approx. 501 Incidents. How to get the next set of incidents? [required for pagination]
- REST API to create/update/delete/view Knowledge ? Any Documentation?
Solved! Go to Solution.
- Labels:
-
Integrations
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-25-2015 08:33 AM
Hi Sanjay,
For pagination, you can make use of the sysparm_offset and sysparm_limit parameters.
For example the following will retrieve 5 records (sysparm_limit=5) in the record set starting from the beginning (sysparm_offset=0) of the record set.
/api/now/v1/table/incident?sysparm_limit=5&sysparm_offset=0&sysparm_query=active=true^ORDERBYnumber
The get the next 5 records, you would simply increment the value of sysparm_offset by the value of your sysparm_limit
/api/now/v1/table/incident?sysparm_limit=5&sysparm_offset=5&sysparm_query=active=true^ORDERBYnumber
Another thing that helps is that you will actually get a link header in the response that provides the urls to first,prev,next and last pages based on values used for sysparm_offset and sysparm_limit. so you might just look into that to get the url to use to get the next page.
Hope this helps!
-Jose
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-13-2015 02:45 AM
Thanks Jose.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-04-2021 05:28 AM
I always receive same set when using offset it does not move to next records but still return same first set
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-29-2015 12:51 PM
Hi Sanjay,
Consider marking the question as answered, or marking replies as helpful as appropriate.
Or ask further questions or tell us what solution you found.
This will add value to Community Members reading this thread.
Best Regards
Tony