Search code examples
artifactory

Get all repositories of two package types via Artifactory API


I'm trying to get all repositories of two package types (Maven and Terraform). The URL I'm trying is:

curl -u username:password -X GET "https://artifactory.es/artifactory/api/repositories?packageType=docker,helm"

But I'm getting only the packages of the first one, in this case Docker packages.


Solution

  • As described in the official docs (The GetRepositories API), you can only get one repo type at a time. Although this would be a nice addition.

    You can use a tool like jq and simply manipulate data from a full list of all repositories.

    curl -u username:password -X GET "https://artifactory.es/artifactory/api/repositories" | jq '[.[] | select (.packageType == "Docker" or .packageType == "Helm")]'
    

    This will leave you with the Docker or Helm repositories only.