Ability to filter API query for packages by version
Related to #348690.
UPDATE: This issue originally requested the ability to filter on version and name. @10io pointed out that there is already the ability to filter on name using the package_name
parameter. Therefore I've changed this issue to request only that the version filter be added.
According to https://docs.gitlab.com/ee/api/packages.html it's possible to GET a list of packages and filter them by package_name
and package_type
. However, it's not possible to filter packages by version. This would be very useful (especially while overwriting existing package versions is not possible (#348955)).
So I'd like to request that package_version
be added as an available filter on the GET request on the packages API.
To be specific, I would like to be able to do the following query:
curl --header "PRIVATE-TOKEN: $GITLAB_TOKEN" "https://gitlab.mycompany.com/api/v4/projects/123/packages?package_type=terraform_module&package_name=my-module/my-system&package_version=0.0.2"
And get only Terraform module packages with name "my-module/my-system" and version "0.0.2".
Currently, the version filter is ignored and I get all versions of packages named my-module/my-system
that have been added to the project, meaning that I have to loop through the list to find the correct package. To add to the complexity, I have to worry about pagination of the response in order to find the package I'm looking for.