Table api sys_user is not returning all accounts or retuned wrong total account

Aakansha2
Kilo Contributor

Hello,

As we are calling Table API for fetching user data (sys_user). where in code i am taking total count of the user with X-Total-Count. And we are using this api https://your-instance.service-now.com/api/now/table/sys_user?sysparm_limit=10000&sysparm_offset=0 for pagination.

As one of our customer have 61189 users (this value is returned by X-Total-Count) but when they are calling this api

https://your_instance.service-now.com/api/now/v1/table/sys_user?sysparm_limit=10000&sysparm_offset=6...

it is returning only one user. it should return 15 accounts. Why this api is not returning all accounts or it is returning wrong total user count. Please help me with that.

 

14 REPLIES 14

Tony Chatfield1
Kilo Patron
Hi, what are the results of your diagnistics? how many records do you see from the table list? Is the query or X-Total-Count incorrect? Is the instance domain seperated?

what are the results of your diagnistics? - we are getting all user account from this 14 account.
how many records do you see from the table list? - As this issue is coming on our customer env. so I am not sure that how records are actually there

Is the query or X-Total-Count incorrect? - I am doubtful for this.

 Is the instance domain seperated? - I don't know. please let me know how can i check this.

Ankur Bawiskar
Tera Patron
Tera Patron

Hi,

check any query business rule is restricting the record count.

whether table is domain separated?

For example, the first time you call the endpoint, sysparm_offset is set to "0". To simply page through all available records, use sysparm_offset=sysparm_offset+sysparm_limit, until you reach the end of all records.

in your case limit is 10000;The third party should send the sysparm_limit and sysparm_offset.

Mark Correct if this solves your issue and also mark 👍 Helpful if you find my response worthy based on the impact.
Thanks
Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

yes, we are sending sysparm_offset+sysparm_limit. And it is working fine for other customer.

how can we check the any business rule is restricting account. can you please tell me the exact steps for do that.