REST API pagination doesn't make sense

kcwong
Tera Contributor

I get the no. of records in sys_attachment: 

kcwong_0-1778843387282.png

Then I query the last record with this: 

kcwong_0-1778845295368.png

1 record in the response, so far so good.
Now I sort in reverse order: 

kcwong_1-1778845347977.png

No result?

1 REPLY 1

kcwong
Tera Contributor

kcwong_0-1778851194952.png

With the key value method instead of offset, I also run into problem. 
With sysparm_query = table_name = change_request, I get there should be 5126 rows from 

/api/now/v1/stats/${TableName}
With first call using sysparm_limit=5000,sysparm_offset=0, sysparm_query=table_name=change_request^ORDERBYsys_id, I get less than 5000 rows.

Fit last sys_id into second call, I get even less. 
Third call becomes 0 and I'm stuck.