restnexus

Nexus REST API query artifacts within a group


I have a Nexus maven repo and I would like to leverage REST API to query the list of artifacts lying in my specific group. I stumbled upon this documentation but it seems to be very concise and I cannot find there what I need.

https://oss.sonatype.org/nexus-restlet1x-plugin/default/docs/rest.html

I want something like this

http://mydomain:8081/nexus/service/local/repositories/list?groupId=com.test.superproduct&repo=snapshots

And it would output me a list

To be more specific I need a list of versions of artifacts lying in a group, but I can extract versions from artifact names too.


Solution

  • It came out that everything I needed is to fetch maven-metadata.xml file that comprises all versions available for this artifact. For example, this URL returns this XML:

    <?xml version="1.0" encoding="UTF-8"?>
    <metadata modelVersion="1.1.0">
      <groupId>com.alibaba.rocketmq</groupId>
      <artifactId>rocketmq-all</artifactId>
      <versioning>
        <latest>3.1.8-SNAPSHOT</latest>
        <release></release>
        <versions>
          <version>3.0.2-open-SNAPSHOT</version>
          <version>3.0.10-ALIYUN-SNAPSHOT</version>
          <version>3.0.11-SNAPSHOT</version>
          <version>3.1.8-SNAPSHOT</version>
        </versions>
        <lastUpdated>20140807060304</lastUpdated>
      </versioning>
    </metadata>