1

I want to get a list (json) of all artifacts in one specific repository via the REST API.

I've already tried:

curl -X GET http://localhost/nexus/service/local/respositories/<reponame>/content/

This works, but it deliveres me a json listing all my subdirectories in this repo. But what I want is a list with all the artifacts contained in all subdirectories.

Someone knows how to do this? Is there a way to iterate through all folders? I was thinking about the search keyword, but I wouldn't know for what to search.

2
  • Do you still use nexus2 or did you upgrade to version 3?
    – 030
    Commented May 12, 2019 at 16:01
  • still using nexus 2 because of various reasons... we are actually thinking to move to another repo manager instead of upgrading - blob stores are not really something exciting
    – alex
    Commented May 13, 2019 at 12:27

2 Answers 2

2

Try this:

# Get status
curl http://localhost:8081/nexus/service/local/status 
# List of repositories
curl http://localhost:8081/nexus/service/local/repositories

For the json parameter:

curl -i -H "Accept: application/json" <url>

More information, see this link

1
  • Thanks for your answer first! But this is not what I am looking for. What I need is a list of the actual content of one repository I want to specify... with the request I wrote I can only get to the first layer of the directory structure (the folders inside the repo). The list I need should include the contents of each folder inside the repo
    – alex
    Commented Jan 7, 2019 at 8:49
0

For nexu3 this how to list artifact using curl:

curl -X GET "http://localhost:8081/nexus/service/rest/v1/search?repository={repository_name}&format=maven2&maven.groupId={groupeID}&maven.artifactId={ArtifactID}&maven.extension={package_type}" -H "accept: application/json"

1
  • Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center.
    – Community Bot
    Commented Feb 22 at 8:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.