账户权限配置
nx-component-upload
Upload component permission
nx-repository-admin-raw-robintest-*
All privileges for robintest repository administration
nx-repository-view-raw-robintest-*
All privileges for robintest repository views
一、获取文件列表
curl -X 'GET' \
'https://nexus.rh.com/nexus/service/rest/v1/components?repository=robintest' \
-H 'accept: application/json'
https://nexus.rh.com/nexus/service/rest/v1/components?repository=robintest
二、上传
curl -X 'POST' \
'https://nexus.rh.com/nexus/service/rest/v1/components?repository=robintest' \
-H 'accept: application/json' \
-H 'Content-Type: multipart/form-data' \
-F 'raw.directory=20230718/' \
-F 'raw.asset1=@github-api.hpi' \
-F 'raw.asset1.filename=github-api.hpi'
https://nexus.rh.com/nexus/service/rest/v1/components?repository=robintest
三、查看单个文件信息
curl -X 'GET' \
'https://nexus.rh.com/nexus/service/rest/v1/components/cm9iaW50ZXN0OmQzNTEwYjdhZDE4ZDgyY2Q4MmFiZWI4Zjc3NTJjOGI1' \
-H 'accept: application/json'
四、下载
curl -u robin:Password@123 https://nexus.rh.com/nexus/repository/robintest/latest/github-api.hpi -o xxx.hpi
五、删除
文件删除干净后,对应目录消失
curl -X 'DELETE' \
'https://nexus.rh.com/nexus/service/rest/v1/components/cm9iaW50ZXN0OmQzNTEwYjdhZDE4ZDgyY2Q4MmFiZWI4Zjc3NTJjOGI1' \
-H 'accept: application/json'
https://nexus.rh.com/nexus/service/rest/v1/components/cm9iaW50ZXN0OmQzNTEwYjdhZDE4ZDgyY2Q4MmFiZWI4Zjc3NTJjOGI1
#curl -s -u user_name:password --request DELETE https://host_name/repository/Folder/artifact.py
curl --request DELETE -u robin:Password@123 https://nexus.rh.com/nexus/repository/robintest/latest/github-api.hpi
附一、通过 groovy 操作 API
https://gist.github.com/oliverdaff/2233777
Clean up nexus artifacts with API groovy
附二、通过 Python 操作API
https://gist.github.com/mrts/b2c212369562e478e53ffdba8adc97ec
Nexus 3 Maven repo artifact deletion with Python
网友评论