Peter Love

Collection Gets - last page

Discussion created by Peter Love on Jul 27, 2016
Latest reply on Jan 8, 2017 by Peter Love

Hi,

 

I think we need to have a consistent way of knowing when we have  reached the end of collections gets.

 

Perhaps, no nextPage returned with the last page, and/or something like a 404 (Not Found) if you request a page that does not exist. And/or some way of knowing the total number of objects so you could work it out yourself.

 

It seems to vary with object.  For DSKs, the nextPage does disappear, and I get a 400.  For users, the nextPage disappears and no users are returned.  But for courses, the only way I see is to keep going until you get a 500 Internal Server Error.

 

For example, if I have four courses and do a get courses with offset 0 and limit 2 I get back:

     'nextPage' => '/learn/api/public/v1/courses?fields=courseId%2CexternalId&limit=2&offset=2'

 

All okay, so get courses with offset 2 and limit 2, get back:

    'nextPage' => '/learn/api/public/v1/courses?fields=courseId%2CexternalId&limit=2&offset=4'

 

Now, get courses with offset 4 and limit 2, and you get a 500 Internal Server Error.

 

Is this the same behaviour for anyone else?

 

Cheers,

Peter

Outcomes