Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Rest API to get list of artifacts from Nexus OSS 3.x Repository

I have created a raw repository in Nexus 3.x and I'm able to upload artifacts to the same. Now I want get the list of all artifacts residing inside that repo using Rest API. Any help is appreciated.

like image 844
Rohith Avatar asked Mar 09 '23 03:03

Rohith


1 Answers

in the current Nexus3.14.0-04 the REST API has become final (no longer "beta") and the curl you need is:

curl -X GET "http://localhost:8081/service/rest/v1/components?repository=central" -H "accept: application/json"

this will return each "component" (group, name, version) with all its assets = each individual file (pom, sha1, md5, jar) who constitue the component

The result is a JSON string.

If instead you want to perform a COMPONENTS search - based on a groupId, artifactId - you can use this curl:

curl -X GET "http://localhost:8081/service/rest/v1/search?repository=central&format=maven2&maven.groupId=com.fasterxml.jackson.core&maven.artifactId=jackson-core&maven.extension=jar" -H "accept: application/json"

this returns COMPONENTS with child ASSETS.

The variant to retrieve only the ASSETS, without grouping them by COMPONENT, is GET /service/rest/v1/search/assets?repository=central&format=maven2&maven.groupId=com.fasterxml.jackson.core&maven.artifactId=jackson-core&maven.extension=jar

like image 139
Pierluigi Vernetto Avatar answered Apr 09 '23 08:04

Pierluigi Vernetto