【问题标题】:How to write Get method Nexus Rest Api?如何编写Get方法Nexus Rest Api?
【发布时间】:2012-01-20 18:28:45
【问题描述】:

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

【问题讨论】:

    标签: api rest get nexus


    【解决方案1】:

    不确定您要查找的信息。

    REST API 文档可在此处获得:

    示例

    获取仓库id

    您开始使用:groupIdartifactIdversion

    $ 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 调用中是强制性的

    工件分辨率信息

    $ 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'
    

    【讨论】:

    • +1 因为文档没有明确表明根 Web 服务端点是 /service/local/
    • 我看到“核心 API”链接已损坏,我找不到备用链接。尽管可以使用以下链接中的说明来查找适当的文档:blog.sonatype.com/people/2012/07/…
    猜你喜欢
    • 1970-01-01
    • 2011-06-25
    • 1970-01-01
    • 2013-01-10
    • 1970-01-01
    • 1970-01-01
    • 2015-11-27
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多