我可以浏览项目的公共摘要,而无需进行身份验证,例如:https://gitlab.com/Boiethios/someproject/snippets。
因此,我希望通过公共API访问此信息。但是,V4 API不允许这样做:GET https://gitlab.com/api/v4/projects/6165269/snippets
返回401
。
我该怎么做?
答案 0 :(得分:0)
最新的gitlab API使用GraphQL。
要获取项目的摘要,可以执行以下请求:
query {
project(fullPath: "username_or_group/projectname") {
snippets {
nodes {
fileName,
title,
blob {
rawPath
}
# You can query some other fields you want
}
}
}
}
可以here对请求进行测试。
该请求必须作为正文发布到网址https://gitlab.com/api/graphql
。