All of the API’s in this post (excluding the Package API) return a set of items, which can be paginated. Check out theLink:header in the HTTP response to viewpagination information, like the next and last page.
Packages API
We’ll start with thePackages API. There are actually two flavors of this API:
Packages “All” API
This API is a package-for-package listing of all the packages in your repository, similar to therepository pages on the website.
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 oneobject, with a link to a collection of the 20versions.
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 thepackagecloud-testpackage of typedebonubuntu/precisefor thecomputology/packagecloud-test-packagesrepository. The response looks like:
Package API
Similarly, following thepackage_urllink returns thePackageDetailsresponse for a given package.
For example:
Conclusion
Expect these changes to roll out to thepackagecloudcommand line tool in the following weeks. We’re excited to see what kind of integrations this will enable for our users!