gitlabgitlab-api

how to delete helm chart from gitlab package with api call


I'm using GitLab package for the helm chart but I'm unable to delete the helm chart from GitLab package using gitlab API

Method I tried: I tried

curl --request DELETE  --header "PRIVATE-TOKEN: TOKEN" "https://gitlab.test.in/api/v4/projects/:id/packages/helm/:stable/charts/:test-0.160.0.tgz"

Is there any way to delete helm chart from GitHub package using gitlab API ?


Solution

  • You need to specify the DELETE request method to your curl command:

    curl --request DELETE --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/projects/:id/packages/:package_id"

    And then fix your package_id as you're not using a correct value. The docs show that package_id should be an integer:

    package_id integer yes ID of a package.

    You can use the API to get a list of IDs of your packages or take a look at the URL displayed in your browser. It'll have a value similar to this:

    https://gitlab.com/my-project/-/packages/12345678

    Where the last value is the package_id