1
votes

Is there a way to list down all packages from Azure DevOps Artifacts feed including from the Upstream Source to be able to inform users that a new package is available. We own several Azure DevOps organizations and our setup is we have a source feed in one organization, then we have also created feeds to the rest of the organizations which has an upstream source pointed to the source feed. Right now, we are replicating all packages to the other feeds by using the download API so that users from each organizations can view the list of packages from its respective organization that it has access to.

We want to know if there's a way via the commandline or maybe even via API to list all packages.

1

1 Answers

0
votes

You can use Get Packages api to list all the packages in a feed. Below is an example to list all the packages in organization scoped feed.

$url = "https://feeds.dev.azure.com/{ORG}/_apis/packaging/feeds/{feedid or feedname}/packages?api-version=5.1-preview.1"

$connectionToken="{PAT}"

$base64AuthInfo= [System.Convert]::ToBase64String([System.Text.Encoding]::ASCII.GetBytes(":$($connectionToken)"))

$result = Invoke-RestMethod -Uri $url -Headers @{authorization = "Basic $base64AuthInfo"} -Method get 

If your feed is a Nuget type feed. You can also use nuget list command. For below example.

nuget list -Source {source url}

Hope above helps!