The documented way of deleting a file from a GitLab project's package registry via curl doesn't seem to work for me.
The documentation says
curl --request DELETE --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/projects/:id/packages/:package_id/package_files/:package_file_id"
so e.g. if I want to delete a file called "myfile.ext" from version 1.0.0 of a generic package called "my-package" in the package registry of a project with id 12345678, I think that means the command should be
curl --request DELETE --header "PRIVATE-TOKEN: <my_access_token>" "https://gitlab.example.com/api/v4/projects/12345678/packages/my-package/package_files/myfile.ext"
but for me this yields
{"error":"package_id is invalid, package_file_id is invalid"}
I tried several close variants of that command as well, none of which worked. Specifically, I was surprised at the differences between the URL for deleting and the URL for uploading, namely:
- the URL for uploading doesn't contain
package_files/ - the URL for uploading does contain the package version just before the file id, e.g.
1.0.0/ - the URL for uploading does contain
generic/to indicate that the package is generic, just before the package id
so I tried all 8 combinations of including/excluding each of those three things, but all 7 other than the original one yielded
{"error":"404 Not Found"}
I am able to upload the file via curl, and I'm able to delete it via the GitLab web UI. How do I delete it via curl, or more generally from the command line?