All of the API’s in this post (excluding the Package API) return a set of items, which can be paginated. Check out the Link: header in the HTTP response to view pagination information, like the next and last page.
We’ll start with the Packages API. There are actually two flavors of this API:
You can access it via: /api/v1/repos/:user/:repo/packages.json
And it looks like:
Package Filtering API
Instead of a package-for-package listing, this API rolls up package versions by name and returns links to more versions of the package. So, if you have 1 package with 20 versions, this API will return one object, with a link to a collection of the 20 versions.
This API also supports a robust criteria for filtering packages by name, architecture, distribution, or specific distribution version.
At it’s most basic, you can filter by package type:
This API url returns all of the versions for that package, distribution, and distribution version. For instance:
This URL is requesting all of the package versions associated with the packagecloud-test package of type deb on ubuntu/precise for the computology/packagecloud-test-packages repository. The response looks like:
Similarly, following the package_url link returns the PackageDetails response for a given package.
Expect these changes to roll out to the package_cloud command line tool in the following weeks. We’re excited to see what kind of integrations this will enable for our users!