Hello,
is there a way how to create API key (key type = System with all permissions) via API or somehow automatically ?
I found following native API:
ApiKeys_CreateOrUpdateApiKey
but when I tried to use this code (powershell):
$conf = '<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="True" DoNotLogResponse="True" /></Inedo.ProGet.ApiKeys.ApiKey>'
$URL = "http://<myservername>/api/json/ApiKeys_CreateOrUpdateApiKey"
$body = @{
ApiKey_Text = "<my new API key>";
ApiKey_Configuration = $conf;
ApiKey_Name = "TestKeyName";
#ApiKey_Id = "2";
ApiKey_Description = "Description API Key"
}
Invoke-RestMethod -Method Post -Uri $URL -Body ($body | ConvertTo-Json) -ContentType "application/json"
I got following error
so it seems I need some API key to create another API key.
The purpose of this is to fully automate installation and configuration of Proget and avoid manual configuration of API key in Proget GUI.
Once API key is created I would like to use that API for configuration of Feeds and Connectors.
Thank you for your response.
Kind regards
Ivan Magdolen