2nd API call to load data with offSet returns duplicate records

I want to load all records from my data store using API calls with pageSize and offSet.
First Call: /data/Links?pageSize=100&offset=0
Second Call: /data/Links?pageSize=100&offset=100

The result set from the second call will contain duplicate records (objectIds) returned in the first call.
I verified only 1 record with the sample objectId exists in the data store.

Any ideas? Thanks.

Hi, Chuck!

A quick check did not reproduce this issue. If you still encounter it, please give us your APP_ID - either here or at support@backendless.com
Thanks

Hi Anatolii- thanks for looking at this.

I see the same behavior in the REST console. I’m testing with PAW, cURL and iOS and all behave the same.

My assumption is if I call pageSize=5 offSet=0, then pageSize=5 offSet=5 should return different records (the “next” 5) but I get duplicates in the second set. See attached.

AppId: 2F1850FF-FD0B-9C5C-FFF3-C8BB2DCE1A00

Thanks again

pagesize5.txt (3.83kB)

I’ve reproduced the error with your data and will work on fixing it (internal ticket - BKNDLSS-12846).

Awesome- Thank you. I can kill the other issue as I’m pretty sure it’s related.

Chuck!

The problem was with your “created” field - there are plenty of rows with exactly the same “created” field value. Since Backendless sorts rows by “created” field by default it retrieved the same entities in not interleaving requests (e.g. from 0 to 5 and from 5 to 10). So in your case you can just add additional ordering by some unique field, for example objectId:
http://support.backendless.com/public/attachments/7966006f528915207b0be5a4641d2f41.png</img>

Hi Anatolii

Great- thanks for finding this. I’ll give it a try.

I will say I’m surprised that Backendless uses a datetime field to order paged sets. Since this field is filled in by the system at the time of record creation, in the case of an import (unless the system is very slow) there will be many records with the same datetime stamp.

1 Like