Search code examples
azure-devopsazure-artifacts

How to get all the artifacts list from Azure feed


How to get the list of all artifacts from Azure feed. Below command is working fine, but getting only first 1000 artifacts.

@ReposList = `curl -u username\@abc.com:key -X GET "https://feeds.dev.azure.com/abc/ProjectName/_apis/packaging/Feeds/FeedName/packages?api-version=5.1-preview.1"`;

But, how we can get rest of the artifacts as well ?

Can some one help on this !


Solution

  • Take a look at the documentation for Artifact Details - Get Packages: https://learn.microsoft.com/en-us/rest/api/azure/devops/artifacts/artifact-details/get-packages?view=azure-devops-rest-6.0.

    There are a couple query parameters you can try passing to get all the artifacts.

    $top is used in order to:

    Get the top N packages (or package versions where getTopPackageVersions=true)

    You can try setting this to an arbitrarily high number and see if that returns the total number of artifacts you expected.

    There is also includeAllVersions which works in the following way:

    True to return all versions of the package in the response. Default is false (latest version only).

    I suggest using one (or both) and see if that helps resolve your situation.

    Something like: curl -u username\@abc.com:key -X GET "https://feeds.dev.azure.com/abc/ProjectName/_apis/packaging/Feeds/FeedName/packages&$top=5000&includeAllVersions=true?api-version=5.1-preview.1"