Pagination in /api/packages is not working

Hi,

I am trying to query the packages API to do some manual cleaning but i am seeing the same results no matter what “skip” is set to.

This request curl -X GET -H "X-Octopus-ApiKey: REDACTED" "REDACTED/api/packages?latest=False&skip=0&take=30"

Yields this response:

{
  "ItemType": "Package",
  "IsStale": false,
  "TotalResults": 107,
  "ItemsPerPage": 30,
  "Items": [
    {
      "Id": "packages-REDACTED-1.9.0",
      "NuGetPackageId": "REDACTED",
      "Title": null,
      "Summary": null,
      "NuGetFeedId": null,
      "Version": "1.9.0",
      "Description": "",
      "Published": "Tuesday, February 9, 2016 2:51 PM",
      "ReleaseNotes": null,
      "PackageSizeBytes": 2146,
      "Links": {
        "Self": "/api/packages/packages-REDACTED-1.9.0",
        "AllVersions": "/api/packages?nuGetPackageId=REDACTED",
        "Feed": "/api/feeds/feeds-builtin",
        "Raw": "/api/packages/packages-REDACTED-1.9.0/raw"
      }
    },
    ...

This request curl -X GET -H "X-Octopus-ApiKey: REDACTED" "REDACTED/api/packages?latest=False&skip=30&take=30" yields the exact same response:

{
  "ItemType": "Package",
  "IsStale": false,
  "TotalResults": 107,
  "ItemsPerPage": 30,
  "Items": [
    {
      "Id": "packages-REDACTED-1.9.0",
      "NuGetPackageId": "REDACTED",
      "Title": null,
      "Summary": null,
      "NuGetFeedId": null,
      "Version": "1.9.0",
      "Description": "",
      "Published": "Tuesday, February 9, 2016 2:51 PM",
      "ReleaseNotes": null,
      "PackageSizeBytes": 2146,
      "Links": {
        "Self": "/api/packages/packages-REDACTED-1.9.0",
        "AllVersions": "/api/packages?nuGetPackageId=REDACTED",
        "Feed": "/api/feeds/feeds-builtin",
        "Raw": "/api/packages/packages-REDACTED-1.9.0/raw"
      }
    },
    ...

In my script, i am following the pagination links in the responses, and those seems to be aware that i am reaching the end of the package list (Page.Next stops appearing), but the data is still the same no matter what skip is set to.

I have tried omitting latest=False and that does not make a difference.

We are currently on version 3.2.15.

Is this a known bug?

Cheers,
Christian

Hi Christian,

Thank you for reporting the bug. I have reproduced it and raised an issue for it. It also looks like the API only returns the latest packages if there is no filter property specified, even if latest=false.

In the meantime, if you specify latest=true it will work, but that is possibly not what you want. You could loop over the results and call /api/packages/<packageid> to get all packages.

Hope that helps till we fix that bug,

Robert W