如何编写Get方法Nexus Rest Api? [英] How to write Get method Nexus Rest Api?

查看:43
本文介绍了如何编写Get方法Nexus Rest Api?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有 groupIdartifactIdversion.我如何使用 Nexus Rest API 编写 GET 请求以获得进一步的工件描述?

I have groupId, artifactId and version. How do i write a GET request using Nexus Rest API in order to get further artifact description?

推荐答案

不确定您要查找什么信息.

Not sure what information you're looking for.

REST API doco 可在此处获得:

The REST API doco is availble here:

您从以下开始:groupIdartifactId版本:

$ curl --silent 'http://repository.sonatype.org/service/local/lucene/search?g=log4j&a=log4j&v=1.2.16' | grep repositoryId
<repositoryId>central-proxy</repositoryId>
<repositoryId>apache-staging</repositoryId>
<repositoryId>central-proxy</repositoryId>
<repositoryId>apache-staging</repositoryId>

repositoryId 在其他 API 调用中是必需的

The repositoryId is mandatory in other API calls

$ curl --silent 'http://repository.sonatype.org/service/local/artifact/maven/resolve?r=central-proxy&g=log4j&a=log4j&v=1.2.16' 
<artifact-resolution>
  <data>
    <presentLocally>true</presentLocally>
    <groupId>log4j</groupId>
    <artifactId>log4j</artifactId>
    <version>1.2.16</version>
    <extension>jar</extension>
    <snapshot>false</snapshot>
    <snapshotBuildNumber>0</snapshotBuildNumber>
    <snapshotTimeStamp>0</snapshotTimeStamp>
    <sha1>7999a63bfccbc7c247a9aea10d83d4272bd492c6</sha1>
    <repositoryPath>/log4j/log4j/1.2.16/log4j-1.2.16.jar</repositoryPath>
  </data>

检索 POM

$ curl --silent 'http://repository.sonatype.org/service/local/artifact/maven?r=central-proxy&g=log4j&a=log4j&v=1.2.16'

取回罐子

$ curl --silent 'http://repository.sonatype.org/service/local/artifact/maven/redirect?r=central-proxy&g=log4j&a=log4j&v=1.2.16'

这篇关于如何编写Get方法Nexus Rest Api?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆