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 :/
-
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?
-
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
-
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
-
-
hi @ales-bahnik_2824 , what happens if you provide an incorrect API key? Do you get an error message?
-
Hi @atripp ,
with incorrect API key:Invoke-RestMethod : Invalid API key
-
@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
- New feed, connect to NuGet.org
- Download NewtonSoft.JSON 3.0.1, then verify package is no longer remote package in UI
- 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.
-
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 ;)