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!
Setting API key permissions
-
Hi,
I have been able to successfully set the permissions for an Admin API keys that has full system access by using the stored proc 'ApiKeys_CreateOrUpdateApiKey'
I am using the same method to create an API key which needs to be able to publish packages to all feeds, can you tell me how the XML should be set?
This works for my Admin System API key
'<Inedo.ProGet.ApiKeys.ApiKey Assembly="ProGetCoreEx">' +
'<Properties ' +
'AllowPackagePromotionApi="False" ' +
'AllowRepackagingApi="False" ' +
'AllowFeedManagementApi="False" ' +
'AllowWebhooksApi="True" ' +
'AllowConnectorHealthApi="True" ' +
'AllowFeedsApi="True" ' +
'AllowDockerBlobReaderApi="False" ' +
'AllowSbomApi="True" ' +
'AllowSbomUpload="True" ' +
'UseApiKeyTasks="False" ' +
'AllowNativeApi="True" ' +
'DoNotLogRequest="False" ' +
'DoNotLogResponse="False" />' +
'</Inedo.ProGet.ApiKeys.ApiKey>'This adds the api Key but gives me no permissions, the check box to 'Add/Repackage' is not getting checked.
I want to give the API key access to Add/Repackage on all feeds
I am using this XML:'<Inedo.ProGet.ApiKeys.ApiKey Assembly="ProGetCoreEx">' +
'<Properties ' +
'AllowPackagePromotionApi="False" ' +
'AllowRepackagingApi="False" ' +
'AllowFeedManagementApi="False" ' +
'AllowWebhooksApi="False" ' +
'AllowConnectorHealthApi="False" ' +
'AllowFeedsApi="False" ' +
'AllowDockerBlobReaderApi="False" ' +
'AllowSbomApi="False" ' +
'AllowSbomUpload="False" ' +
'UseApiKeyTasks="True" ' +
'AllowNativeApi="False" ' +
'DoNotLogRequest="False" ' +
'DoNotLogResponse="False" />' +
'</Inedo.ProGet.ApiKeys.ApiKey>'Are there any docs that explain these permissions or are you able to help me to see where I am going wrong?
thanks
-
Hi @forbzie22_0253,
We don't document the specifics of the Native API, so I'm not sure. Your best bet is to study the underlying Stored Procedure and see what's going on there - that's something we do when needing to use the methods.
That said, this Native API methods have been removed in ProGet 2024 in favor of
Create ApiKey
:
https://docs.inedo.com/docs/proget-api-apikeys-createBest,
Alana
-
Thanks I will take a look at the latest version.
Do Inedo recommend using pgutil instead of the usual HTTP APIs going forward?
Will their be feature parity between the API and pgutil ?
Just wondering what we should be using as the best way to programmatically manage ProGet going forward.
Thanks
-
Hi @forbzie22_0253 ,
Some of this is discussed on some recently published docs, but let me summarize some key points.
In general, we recommend using pgutil for programmatic access to ProGet, but HTTP Endpoints may be more appropriate for working with structured data an advanced integration.
If you're using .NET/C#, you may find the
Inedo.ProGet
library helpful:
https://docs.inedo.com/docs/proget-reference-api#net-library-nuget-packageOverall, we are working towards aligning our HTTP Endpoints and developing new ones using a pgutil-first approach. This means we will prioritize the CLI experience by creating intuitive and self-documenting commands. Then we will use existing HTTP Endpoints and develop new ones to fit those commands.
Thanks,
Alana
-
This post is deleted!
-
Hi,
I am using the new Create Api key API here: https://github.com/Inedo/pgutil/blob/thousand/Inedo.ProGet/ApiKeyInfo.cs
/api/api-keys/create
When I use Invoke-RestMethod against this new API it returns the error: Invoke-RestMethod : Required property missing: feedPermissions
When checking the ApiKeyInfo.cs there is no property called 'feedPermissions' ?
I also tried packagePermissions as thats the property in the .cs file but no joy.
I am using Proget version 24.0.6.6
-
The error is incorrect; should say
Required property missing: packagePermissions
.Since we don't document that one very well yet, I'd make sure it works with
pgutil
., and consider capturing traffic. Then, if you have an example we can post on the docs page, happy to add that to the docs.Here is the client code as an FYI:
https://github.com/Inedo/pgutil/blob/thousand/pgutil/ApiKeys/Create/FeedCommand.csThanks,
Alana
-
@atripp thanks, resolved now.