API call not returning all the rows

RussellDeVore
Kilo Contributor

I have been running inconsistent row counts when running my API call. the call below gives an X-total-Count of 37, but the JSON output is only 30 records

 

/api/now/table/sys_user?sysparm_query=sys_updated_on>=javascript:gs.hoursAgoStart(100)&sysparm_fields=sys_id,first_name,last_name&sysparm_query=ORDERBYsys_id

 

If I drop the time restraint, I am still short rows, if I reduce the time constraint, I get a consistent number of rows. I am not worried about offsets, as this is way under the 10,000 limit. I'm not concerned about data size as it is just the 3 columns, and has been under 5KB. 

 

My hypothesis is the table on the backend is maintain each change to a sys_user, but the API pull filters out so you only get the most recent one. I unfortunately have no way to test or verify this. If someopne has any suggestions as to what is causing this, please let me know.

1 REPLY 1

Tony Chatfield1
Kilo Patron

Hi, unfortunately your issue is not clear from your post.
To clarify, the table holds the 'current' values for each record with sys_updated_on being timestamp for the last update made to the record, and record audit\history data is held in other tables .

What do your results look like if you query the table with no conditions?

Also, I would expect the API to honor any ACL's for the table (for the account being used to make the query.)
If you impersonate the user account involved and run the same query in UI, do you see same results?
Are any records excluded by security constraints?