request limit
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-10-2024 07:06 AM
Guys, I was instructed to extract data via API from an endpoint of a company that is using ServiceNow. I am part of a third-party company so I cannot change the ServiceNow of the company that provided the endpoint. My question is, I saw that to get data via GET there is a limit of up to 10 thousand records. Is there any way I can get all the records without having this limit?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-10-2024 07:15 AM - edited ‎09-10-2024 07:15 AM
Increasing the maximum returned record (10000 by default) may have performance implications. The method I recommend to retrieve largeer amounts of records is to use pagination. It is explained very clearly in this video:
https://www.youtube.com/watch?v=6A4H9lhju4s
IF YOU WANT QUICK AND DIRTY:
The 10000 limit is being caused by omission of the parameter sysparm_limit which default value is 10000. If you specify a higher value in the URL then you can get the desired amount of records.
Example: /api/now/table/incident?sysparm_limit=40000
Regards
Paul
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-10-2024 07:35 AM
The problem is, I don't know how much data there is in total and unfortunately when I don't set a limit, it brings up to 10 thousand, and I can't know how much data there is in total precisely because of that, and I can't apply a limit because I don't know how much data there is, and I know that every day they increase.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-10-2024 08:47 AM
Read up on sysparm_offset.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-10-2024 10:37 AM - edited ‎09-10-2024 10:39 AM
I'm trying to implement it, I'm doing gets trying to get 10 at a time, but I always get only the first 10, and not the following ones, and I don't know if my url is wrong, @thomaskennedy
const orderby = 'ORDERBYopened_at';
const fields = 'opened_at,number';
export const url = `${baseUrl}?sysparm_query=${orderby}&sysparm_fields=${fields}&sysparm_limit=10&sysparm_offset=10`;