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!
Error deleting Debian package from API
-
Hi,
I'm trying to remove packages from a Debian feed using the HTTP Request described in the API documentation: https://docs.inedo.com/docs/proget/reference-api/proget-api-packages/proget-api-packages-delete#http-request-specification
But it always returns an error 400 - Missing required qualifier component: distro, despite my using the purl returned by the server, as it's described here: https://docs.inedo.com/docs/proget/reference-api/proget-api-packages#using-a-purl-to-identify-a-packageI'm making this POST request https://serverip/api/packages/unstable-lin/delete?purl=pkg:deb/scatimysqlcluster@7.3.0.0-0.202406122314.6df3a85167?arch=amd64&component=scati&distro=jammy from a python script.
It doesn't seem to be a code error because the same script with a Windows purl works perfectly https://serverip/api/packages/unstable-win/delete?purl=pkg:nuget/scativision@7.3.5-2024-06-11Thanks a lot.
-
Hi @Scati ,
The request looks OK to me on a first glance, but I wonder... did you try using
pgutil
to delete the package?pgutil packages delete --feed=myDebianFeed --package=myDebianPackage --version=2.3.4 --component=main --distro=stable --arch=amd64
I'm not sure if you're using the latest version of ProGet, but I think there was a bug regarding this.
Thanks,
Alana
-
Hi @atripp,
using pgutil works OK:pgutil packages delete --feed=unstable-lin --package=scatimysqlcluster --version=7.3.0.0-0.202406122314.6df3a85167 --component=scati --distro=jammy --arch=amd64 Deleting scatimysqlcluster 7.3.0.0-0.202406122314.6df3a85167 arch=amd64&component=scati&distro=jammy from unstable-lin feed... Package deleted.
Although I'm not sure if it's the same, as pgutil doesn't really use a purl. In any case, we'd rather use the HTTP API to keep everything contained within the script code.
Thanks.
-
Hi @Scati,
pgutil will construct an purl using this method:
https://github.com/Inedo/pgutil/blob/c5b5e3733390b9e5dfb07752e36a3f6efaaa0f9c/pgutil/Packages/QualifierOptions.cs#L26So I'm thinking there's something off about your url, but I can't spot it. Maybe try
That appears to be the order that pgutil uses...
Cheers,
Alana
-
Hi again @atripp,
I'm afraid it doesn't work by changing the order either. I tried with a simpler package version, not a prerelease one, and it fails in the same way:ERROR - Error '400 Client Error: Bad Request for url: https://serverip/api/packages/unstable-lin/delete?purl=pkg:deb/scatinat@7.2.2.0-1?arch=amd64&distro=jammy&component=scati'
As I mentioned, I'm just catching the purl from a previous API request. Would you have any other suggestions to try?
Thanks.
-
Hi @Scati
Working with package qualifiers and purls is a little confusing with the API because they are already in a URL encoded query string format and you have to encode them again to be passed in through the API url. If you url encode what you are passing in to
purl=
then it should work:https://serverip/api/packages/unstable-lin/delete?purl=pkg%3Adeb%2Fscatinat%407.2.2.0-1%3Farch%3Damd64%26component%3Dscati%26distro%3Djammy
The complexity of dealing with these is the reason we added all of the extra arguments and handling in pgutil to build these qualifiers out more easily.
Hope this helps!
-Greg
-
Hi @gdivis,
I've tried encoding the purl URL, and it works on both Windows and Linux, without having to interchange the distro and component order. However, it's a little strange that NuGet package purls work whether they are encoded or not.
Anyway, I'm going to encode the URL in the code.Thank you very much.