Does packages.ubuntu.com provide a search API?
The Debian package directory provides a simple API to search for package releases. For instance this query results can be accessed as JSON at https://sources.debian.net/api/src/libtry-tiny-perl/. Is there a similar API for http://packages.ubuntu.com/?
As commented by muru, everything in Ubuntu is on Launchpad. Launchpad's API can also be used to search for package releases. To give an example:
- package libtry-tiny-perl at packages.ubuntu.com
- package libtry-tiny-perl at Launchpad
- package libtry-tiny-perl at Launchpad API (limited response)
To get API response as JSON, use curl:
$ curl https://api.launchpad.net/devel/ubuntu/+source/libtry-tiny-perl
Package releases can be queried with query parameter
source_name
at base URL https://api.launchpad.net/1.0/ubuntu/+archive/primary?ws.op=getPublishedSources&&exact_match=true, for instance:
$ curl 'https://api.launchpad.net/1.0/ubuntu/+archive/primary?ws.op=getPublishedSources&source_name=libtry-tiny-perl&exact_match=true'
The API documentation is a bit complicated, even with the official API client launchpadlib so it took me some time to find out. The Ubuntu version of a package release is given in field distro_series_link
.