Welcome to the Inedo Forums! Check out the Forums Guide for help getting started.

If you are experiencing any issues with the forum software, please visit the Contact Form on our website and let us know!

How to delete packages with the ProGet REST API?



  • I cannot find any way to delete individual packages with the ProGet REST API, or am I mistaken?

    The problem is, ProGet's retention policies are too limited for our use-case and we will need to write something ourselves. But it only seems that we can delete an entire feed with the API, and not individual packages (or groups). Is it really not possible to delete a group or individual package from the API?


  • inedo-engineer

    Hello, you can definitely delete packages form the API!

    But please note, from the API Docs page:

    API for Third-party Packages and Feed Types

    In order to support third-party package formats types like NuGet, npm, etc., ProGet implements a variety of third-party APIs. We only provide minimal documentation for these APIs, as they are generally either already documented elsewhere. However, you can generally find the basics by searching for specific things you'd like to do with the API, such as "how to search for packages using the NuGet API" or "how to publish an npm package using the API".



  • @atripp I must be missing something obvious then. Can you please point me to the API documentation which covers deleting packages? In https://docs.inedo.com/docs/proget/reference/api, I see only:

    • Package Promotion API - does not cover deletion
    • Webhook Management API - not relevant
    • Asset Directory API - not relevant
    • Feed Management API - only covers deleting entire feeds, not packages
    • Connector Health API - not relevant
    • Package Deployment API - only covers deploying packages, not deleting them
    • Security Management API - not relevant


  • To delete a package using curl:

    curl -kL -v -X DELETE -u Admin:<pass> http://<api endpoint url>/package/<package_name>/<package_version>

    you can get the api endpoint url from the feed settings. top right hand corner.


  • inedo-engineer

    Thanks @kvasudevan_8753 - that definitely will do it :)

    @nik-reiman_6009 package interaction is done through the package-specific, third-party apis; we only provide minimal documentation for these APIs, as they are generally either already documented elsewhere. We simply implement those API.

    So in this case, if you search for how to delete a nuget package from the api, the first result is from Microsoft which details how to Push and Delete packages from a NuGet API



  • Dropping late here, but I've just asked a similar question in this thread, it may be of use to anyone who stumbles in here: https://forums.inedo.com/topic/3318/proget-delete-all-versions-of-a-package-via-api



  • Can anyone confirm that this works for maven packages? I'm going insane trying to figure out how to delete maven packages programatically like I can with NuGet. DELETE requests are outright rejected with the following message:

    Only GET, HEAD, and PUT are supported for this URL.

    Is there any way to delete a maven package without going through one by one the entries in all feeds and clicking on delete artifact, then confirming YES?


  • inedo-engineer

    Hi @jim-borden_4965 ,

    The Maven API doesn't support artifact deletion, and we haven't had any requests for that to date. I suppose, usually because it's pretty rare to need to delete a package :)

    In general, users configure automatic retention rules to delete older things.

    From a UI-perspective, there is the "bulk package deletion" that's available in ProGet 2022 and later, and so that might save a bunch of clicks.

    Cheers,
    Nanci



  • Hey @NanciCalo,

    I'm working with Jim Borden on this. We are maintaining a local maven cache which, unlike a full-on public maven server, should be able to delete stuff.

    We are finding it particularly confusing since, using the API, we, absolutely, can delete packages. It is pretty annoying, though, to have to do it, clicking twice, for each package we want to delete. Surely there must be some way to do it programmatically?

    Can you point me at the "bulk package deletion"? That might be just the ticket!!

    Thanks
    Blake Meike



  • To add a bit more detail, we are basically trying to do our own retention with the free version where actual retention rules are not available. This is easy enough with NuGet, and I have a script that keeps things tidy. We are hosting CI builds inside and we don't need the entire history of the world inside. Same with maven. I have gotten to the point of being able to enumerate package versions with maven via its metadata, but there is simply no programmatic way to delete them it seems (despite the UI allowing it).


  • inedo-engineer

    Hi @blake-meike_5923, hi @jim-borden_4965 ,

    The "bulk delete" is in ProGet 2022 - you just navigate to "Packages", click "bulk edit", and select the ones you wish to delete.

    Otherwise we haven't implemented a DELETE endpoint for Maven artifacts, so it's not going to be possible programmatically until we do. Unlike the NuGet client, the Maven client doesn't have any delete capabilities and no one else has asked for a custom API endpoint.

    In ProGet 2023, we do intend on making an API that would work across all package types, but that's a whiles off. We can consider adding and documenting a custom Maven DELETE endpoint, but the use case of "working-around a paid feature" isn't exactly a big motivation for us to prioritize a change 😏

    Cheers,
    Alana



  • I understand the lack of motivation for our case, certainly. An API that works across all packages types would probably be even better than a maven specific one. On one final side note, though, is it normal for the delete button in the UI to leave the actual backing files intact? I am noticing that is what happens. The entry disappears from the feed but the files are left on the system.


  • inedo-engineer

    @jim-borden_4965 that doesn't sound right; can you create a new forum post (don't want to clutter this anymore) with some more details/etc, and then we can reply/investigate. Thanks 👍


Log in to reply
 

Inedo Website HomeSupport HomeCode of ConductForums GuideDocumentation