API Return Count not Correct. Missing Records.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-20-2024 09:01 AM
I have the following API call and when I run it with sysparm_offset=1, I get the 100 expected records. Move to 101 and I get 99 records and it seems like every time I increase the offset, I am only getting 99 records.
Took a while to figure this out as when I set the limit to 5k, I was getting 4921 records and not the expected 5k.
As far as I can tell this is the correct syntax for the API call. Any ideas what I am missing? I am using Postman to test the API calls and Power BI to validate the json output.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-20-2024 06:28 PM
Hi, unfortunately the truncated text doesn't clearly identify your url format and without details of how you are indexing your sysparm_offset, and I assume matching sysparm_limit, it's not possible to help diagnose your issue based on details provided.
Normally the offset is indexed by the same number of records returned by the limit, and your post implies that you return records 1-101, then 2-102, 3-103 etc.
Can you clarify your configuration?
This KB article may also help clarify possible cause if the issue is caused by indexing\returning 1 record.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-21-2024 05:26 AM
That's weird it truncated. Lets see if the whole URL comes through in this post. I add ======= before and after.
==============
=============
Thx....
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-21-2024 05:45 AM
That's weird it truncated. Lets see if the whole URL comes through in this post. I add ======= before and after.
==============
=============
Thx....
Mike
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-21-2024 06:02 AM
That's weird that it truncated and sorry if I wasn't clearer.
What happening is:
- sysparm_limit=100 and offset=0 I get records 1-100 (returns 100 records)
- sysparm_limit=100 offset=101 I get 101-199 (returns 99 records)
- sysparm_limit=100 offset=201 I get 201-299 (returns 99 records)
https://DevInstanceName.service-now.com/api/now/table/incident?sysparm_query=ORDERBYDESCopened_at^opened_at>=javascript:gs.dateGenerate('2023-01-01','00:00:00')&sysparm_display_value=true&sysparm_exclude_reference_link=true&sysparm_fields=number,opened_at,opened_by,sys_updated_on,priority,impact,state,assigned_to,assigned_to.title,assigned_to.employee_number,assigned_to.u_employee_type,assigned_to.u_employee_status,short_description,sys_class_name,assignment_group&sysparm_limit=100&sysparm_offset=1
Thanks!
Mike...
