Artifactory Create Repository Rest API不起作用
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Artifactory Create Repository Rest API不起作用相关的知识,希望对你有一定的参考价值。
我有Artifactory专业版许可证,如下页所示,我打电话给rest api。
我已经验证所有其他API(如存储库列表,帐户创建和列表)都能正常工作,但我已确认存储库创建api不能处理400个错误。
我想通过更改日志级别来查看错误,但是没有关于跟踪日志级别出现400错误的原因的信息。
以下是相关日志:
2018-06-15 10:31:34,028 [http-nio-8081-exec-15] [TRACE] (o.a.a.d.r.DockerV2AuthenticationFilter:84) - DockerV2AuthenticationFilter path: /api/repositories/newrepo
2018-06-15 10:31:34,028 [http-nio-8081-exec-15] [DEBUG] (o.a.w.s.a.AuthenticationFilterUtils:105) - Entering ArtifactorySsoAuthenticationFilter.getRemoteUserName
2018-06-15 10:31:34,028 [http-nio-8081-exec-15] [DEBUG] (o.a.w.s.AccessFilter:299) - Cached key has been found for request: '/artifactory/api/repositories/newrepo' with method: 'PUT'
2018-06-15 10:31:34,028 [http-nio-8081-exec-15] [TRACE] (o.a.s.PasswordDecryptingManager:95) - Received authentication request for org.artifactory.security.props.auth.PropsAuthenticationToken@3dc5bccf: Principal: null; Credentials: [PROTECTED]; Authenticated: false; Details: org.springframework.security.web.authentication.WebAuthenticationDetails@b364: RemoteIpAddress: {IP}; SessionId: null; Not granted any authorities
2018-06-15 10:31:34,029 [http-nio-8081-exec-15] [DEBUG] (o.j.a.c.h.AccessHttpClient:109) - Executing : GET http://localhost:8040/access/api/v1/users/?cd=apiKey_shash%3DGprGDe&exactKeyMatch=false
2018-06-15 10:31:34,035 [http-nio-8081-exec-15] [DEBUG] (o.a.w.s.AccessFilter:305) - Header authentication org.artifactory.security.props.auth.PropsAuthenticationToken@c20ca8df: Principal: admin; Credentials: [PROTECTED]; Authenticated: true; Details: org.springframework.security.web.authentication.WebAuthenticationDetails@b364: RemoteIpAddress: {IP}; SessionId: null; Granted Authorities: admin, user found in cache.
2018-06-15 10:31:34,035 [http-nio-8081-exec-15] [DEBUG] (o.a.w.s.RepoFilter :100) - Entering request PUT (10.191.128.129) /api/repositories/newrepo.
2018-06-15 10:31:34,038 [http-nio-8081-exec-15] [DEBUG] (o.a.w.s.RepoFilter :188) - Exiting request PUT (10.191.128.129) /api/repositories/newrepo
更新
- 我的工具版本:6.0.2
- 响应来自Artifactory的消息:{“errors”:[{“status”:400,“message”:“找不到有效的存储库类型。 n”}]}
- 存储库创建Json消息:{“key”:“newrepo”,“rclass:”local“,”packageType“:”docker“,”dockerApiVersion“:”V2“,”includesPattern“:”** / *“,”excludesPattern “:”“,”repoLayoutRef“:”simple-default“,”description“:”“,”checksumPolicyType“:”client-checksums“,”blackedOut“:false,”propertySets“:[”artifactory“]}
谢谢
在你的JSON中,你错过了“在rclass之后。
你写了'“rclass:'它应该是'”rclass“:'
一旦修复此命令应该正常工作。祝好运 :)
curl -iuadmin:password -X PUT http://localhost:8081/artifactory/api/repositories/newrepo -H "Content-type:application/vnd.org.jfrog.artifactory.repositories.LocalRepositoryConfiguration+json" -T repo_temp.json
HTTP/1.1 100 Continue
HTTP/1.1 200 OK
Server: Artifactory/5.11.0
X-Artifactory-Id: bea9f3f68aa06e62:4db81752:1643a9cff9e:-8000
Content-Type: text/plain
Transfer-Encoding: chunked
Date: Tue, 26 Jun 2018 06:57:24 GMT
Successfully created repository 'newrepo'
repo_temp.json:
{
"key": "newrepo",
"rclass": "local",
"packageType": "docker",
"dockerApiVersion": "V2",
"includesPattern": "**/*",
"excludesPattern": "",
"repoLayoutRef": "simple-default",
"description": "",
"checksumPolicyType": "client-checksums",
"blackedOut": false,
"propertySets": ["artifactory"]
}
如果content-type标头包含charset,则Artifactory会以某种方式返回此错误,例如:Content-Type: application/json; charset=UTF-8
尝试简单地使用Content-Type: application/json
以上是关于Artifactory Create Repository Rest API不起作用的主要内容,如果未能解决你的问题,请参考以下文章
CentOS 8安装JFrog Artifactory社区版解决方案
Artifactory——启动错误[Artifactory failed to initialize: check Artifactory logs for errors.]解决方案
如何在云上创建自己的 Artifactory,例如 AWS 的 Codeartifact、Jfrog 的 Artifactory
Artifactory:升级到新的 Artifactory 5.10.3 并支持新的 Pypi 后,本地 Pypi 存储库“慢”