Artifactory: API – List Repositories – cURL

Artifactory has a REST API that can be used to get a list of minimal repository details for all repositories from the command line.

In this note i will show how to list repositories in Artifactory through the REST API using cURL and how to filter repositories by repository and/or package type.

Cool Tip: Default password and how to access REST API in Artifactory! Read more →

Artifactory API to List Repositories

List all repositories in Artifactory:

$ curl -sSf -u "<USERNAME>:<PASSWORD>" \
       'http(s)://<ARTIFACTORY_URL>/api/repositories'

The API call above returns the repo key, type, description, URL and packageType of the each repository in Artifactory.

List Artifactory repositories of the specific type:

$ curl -sSf -u "<USERNAME>:<PASSWORD>" \
       'http(s)://<ARTIFACTORY_URL>/api/repositories?type=<repoType>'

repoType can be one of local, remote, virtual, federated, distribution, for example, to list all local Artifactory repositories, execute:

$ curl -sSf -u "<USERNAME>:<PASSWORD>" \
       'http(s)://<ARTIFACTORY_URL>/api/repositories?type=local'

List Artifactory repositories of the specific package type:

$ curl -sSf -u "<USERNAME>:<PASSWORD>" \
       'http(s)://<ARTIFACTORY_URL>/api/repositories?packageType=<packageType>'

packageType can be one of cocoapods, opkg, rpm, nuget, cran, gems, npm, bower, debian, composer, pypi, docker, vagrant, gitlfs, go, yum, conan, chef, puppet, generic, for example, to list all docker Artifactory repositories, execute:

$ curl -sSf -u "<USERNAME>:<PASSWORD>" \
       'http(s)://<ARTIFACTORY_URL>/api/repositories?packageType=docker'

repoType and packageType can be combined in one query, for example, to list all remote RPM repositories in Artifactory, execute:

$ curl -sSf -u "<USERNAME>:<PASSWORD>" \
       'http(s)://<ARTIFACTORY_URL>/api/repositories?type=remote&packageType=rpm'

Cool Tip: List artifacts in Artifactory’s repository using cURL! Read more →