Inedo Community Forums Forums
    • Recent
    • Tags
    • Popular
    • Login

    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!

    API delete command did nothing :/

    Scheduled Pinned Locked Moved Support
    7 Posts 3 Posters 16 Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • A Offline
      ales.bahnik_2824
      last edited by ales.bahnik_2824

      Hello,

      I am traying to delete nuget package via API because of free edition. Using command:

      Invoke-RestMethod -Method Delete -Uri "http://ipserver:8624/nuget/feedID/nugetPackageName/NugetPackageVersion" -Headers @{"X-NuGet-ApiKey"="apiKeyPassword"}
      

      Command is executed without error but nothing happened. Package is still on disk and can be found in "Packages".

      Pls how can I delete nuget packages with PowerShell?

      1 Reply Last reply Reply Quote 0
      • Dan_WoolfD Offline
        Dan_Woolf inedo-engineer
        last edited by

        Hi @ales-bahnik_2824,

        Your command looks correct. Have you noticed this happen with any other package you are attempting to delete? Does it work if you delete the package from the UI? Also, are you using a personal API Key or a global key?

        Thanks,
        Dan

        A 1 Reply Last reply Reply Quote 0
        • A Offline
          ales.bahnik_2824 @Dan_Woolf
          last edited by

          Hello @Dan_Woolf ,

          I have tried it with other packages - the same result :/ With UI it work but I want to delete many packages by script.

          API Key:

          • key type Feed

          • package permission:full (view/download,add/repackage,promote, overwrite/delete)

          Thanks,
          Ales

          atrippA 1 Reply Last reply Reply Quote 0
          • atrippA Offline
            atripp inedo-engineer @ales.bahnik_2824
            last edited by

            hi @ales-bahnik_2824 , what happens if you provide an incorrect API key? Do you get an error message?

            A 1 Reply Last reply Reply Quote 0
            • A Offline
              ales.bahnik_2824 @atripp
              last edited by

              Hi @atripp ,
              with incorrect API key: Invoke-RestMethod : Invalid API key

              atrippA 1 Reply Last reply Reply Quote 0
              • atrippA Offline
                atripp inedo-engineer @ales.bahnik_2824
                last edited by

                @ales-bahnik_2824 thanks; so that tells us the call is making it to ProGet OK, and there are no permissions issues. If there were permissions problems, you'd get an error like you did above.

                Not sure what to do from here. I tried very quickly to reproduce, and the package deletes fine

                1. New feed, connect to NuGet.org
                2. Download NewtonSoft.JSON 3.0.1, then verify package is no longer remote package in UI
                3. Run below powershell, then verify package is now a remote package in UI
                PS C:\Users\atripp> Invoke-RestMethod -Method Delete -Uri "http://proget.localhost/nuget/nugets/package/Newtonsoft.Json/13.0.1" -Headers @{"X-NuGet-ApiKey"="058fca3993cde88d771b142b876913a0a126f16b"}
                

                The delete will not produce an error if the package doesn't exist. So maybe it's already deleted.

                Otherwise I'm not sure how else to debug. The method the API and Web page call are exact the same.

                A 1 Reply Last reply Reply Quote 0
                • A Offline
                  ales.bahnik_2824 @atripp
                  last edited by

                  Hi @atripp ,
                  after yours testing I found mistake in URL - my URL was without /package/. When I use proper URL to request, package was succesfully deleted.

                  Thank you for quick support and sorry about my novice mistake ;)

                  1 Reply Last reply Reply Quote 0

                  Hello! It looks like you're interested in this conversation, but you don't have an account yet.

                  Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

                  With your input, this post could be even better 💗

                  Register Login
                  • 1 / 1
                  • First post
                    Last post
                  Inedo Website Home • Support Home • Code of Conduct • Forums Guide • Documentation