sonatype nexus api

Get status

curl http://localhost:8081/nexus/service/local/status

should display something like

Sonatype Nexus Professional

Sonatype Nexus™ Professional Edition, Version: 2.1.2

2.1.2

2.1.2

Professional

PRO

List of repositories

curl http://localhost:8081/nexus/service/local/repositories

Getting a list of all users, now with authenticating as admin user

curl -X GET -u admin:admin123 http://localhost:8081/nexus/service/local/users

result e.g.

http://localhost:8081/nexus/service/local/users/anonymous

anonymous

use http://localhost:8081/nexus/nexus-indexer-lucene-plugin/default/docs/rest.lucene.search.html

curl -X GET -u admin:admin123 http://localhost:8081/nexus/service/local/lucene/search?q=testng

curl -X GET -u admin:admin123 http://localhost:8081/nexus/service/local/lucene/search?g=org.testng&a=testng&v=6.7

get pom

documentation at http://localhost:8081/nexus/nexus-core-documentation-plugin/core/docs/rest.artifact.maven.html

curl -X GET -u admin:admin123 http://localhost:8081/nexus/service/local/artifact/maven?r=central&g=junit&a=junit&v=4.10

get artifact

documentation at http://localhost:8081/nexus/nexus-core-documentation-plugin/core/docs/rest.artifact.maven.content.html

curl -X GET -u admin:admin123 “http://localhost:8081/nexus/service/local/artifact/maven/content?g=org.testng&a=testng&v=LATEST&r=central

resolve details about latest version of testng

curl -X GET -u admin:admin123 “http://localhost:8081/nexus/service/local/artifact/maven/resolve?r=central&g=org.testng&a=testng&v=LATEST

above snippet in a shell script extracting the version could look like this:

VERSION=curl -X GET -u admin:admin123 "http://localhost:8081/nexus/service/local/artifact/maven/resolve?r=central&g=org.testng&a=testng&v=LATEST" | sed -n 's|<version>\(.*\)</version>|\1|p'
echo “Version is $VERSION”

result should be 6.7 at the moment

And heck out the blog post http://www.sonatype.com/people/2012/07/learning-the-nexus-rest-api-read-the-docs-or-fire-up-a-browser/ about how to use the browser debug tools to monitor rest api calls of the nexus user interface itself

Contact GitHub API Training Shop Blog About

评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值