List package files

When I list package files in the REST API I get a list of 19 files with the URL: https://gitlab.example.com/api/v4/projects/:id/packages/4/package_files

BUT there exist more than 19 and I get only the oldest.

Are there any limitation in the REST API?
Is it any configurations to get more than 19 files?

According to Packages API | GitLab there seems not to be possible to sort the list with the URL, https://gitlab.example.com/api/v4/projects/:id/packages/4/package_files or does it exist any way to do a sorting.

BR, Lars Klingefäll

I have read the documentation, Packages API | GitLab more careful, I found:

By default, the GET request returns 20 results, because the API is paginated

Then it will work with, https://gitlab.example.com/api/v4/projects/:id/packages/4/package_files?&per_page=1&order_by=id&sort=desc to get the latest file.

BUT sorting seems not to work, I get only the item with the lowest id.

BR, Lars Klingefjäll

I found out following solution:

  1. Call https://gitlab.example.com/api/v4/projects/:id/packages/4/package_files?&per_page=1
  2. Get the x-total in the header and if it 64
  3. Call again: https://gitlab.example.com/api/v4/projects/:id/packages/4/package_files?&per_page=1&page=64