简体   繁体   English

gitlab 的本地实例不响应位于“/gitlab/doc/api/v4”中的 API 文档中的 REST 调用

[英]Local instance of gitlab does not respond to REST-calls from the API documentation located in "/gitlab/doc/api/v4"

I have undertaking a master thesis project that uses the openapi.yaml files to auto generate test for REST-api web-services - This has lead me to host a local instance of gitlab, so that I can run the tool I am working on, on gitlab. I have undertaking a master thesis project that uses the openapi.yaml files to auto generate test for REST-api web-services - This has lead me to host a local instance of gitlab, so that I can run the tool I am working on, on gitlab . For that to happen I need the .yaml files containing the documentation for the API calls.为此,我需要.yaml文件,其中包含 API 调用的文档。 Such files are found within in the gitlab source-code, but the call does not seem to work.此类文件可在 gitlab 源代码中找到,但该调用似乎不起作用。

Some calls work, namely:一些电话有效,即:

http://localhost/api/v4/version http://localhost/api/v4/users http://localhost/api/v4/projects http://localhost/api/v4/groups http://localhost/api/v4/version http://localhost/api/v4/users http://localhost/api/v4/projects http://localhost/api/v4/groups

all returns meaningful JSON.所有返回有意义的 JSON。

the problem is that a lot of the calls within the documentation does not work (returns a "404 not found"), namely:问题是文档中的很多调用都不起作用(返回“404 not found”),即:

http://localhost/api/v4/metadata http://localhost/api/v4/projects/{id}/access_tokens http://localhost/api/v4/metadata http://localhost/api/v4/projects/{id}/access_tokens

and more calls specified in the documentation.以及文档中指定的更多调用。

The problem is that a lot of the calls that work are not documented (all of the above except the 'version' call).问题是很多有效的调用都没有记录(除了“版本”调用之外的所有调用)。 I have really tried to look for an alternative openapi.yaml files, but with little success and I am also puzzled to why the one left in the actual source-code does not contain meaningful documentation.我真的试图寻找一个替代的openapi.yaml文件,但收效甚微,我也很困惑为什么留在实际源代码中的文件不包含有意义的文档。 Have I overlooked something?我忽略了什么吗? I am currently using postman and providing a sudo authentication-token.我目前正在使用 postman 并提供 sudo 身份验证令牌。

Thanks in advance - I must surely have overlooked something!在此先感谢-我肯定忽略了一些东西!

Currently I have tried to look for an alternative openapi.yaml both by googling and be browsing swaggerhub.com.目前,我试图通过谷歌搜索和浏览 swaggerhub.com 来寻找替代的openapi.yaml I Have look at the documentation pages for gitlab, but I have not found anything I did not already have.我查看了 gitlab 的文档页面,但我还没有找到任何我没有的东西。

Unfortunately, at this time of writing, GitLab does not provide an OpenAPI spec for all of its API.不幸的是,在撰写本文时,GitLab 并未为其所有 API 提供 OpenAPI 规范。 Only a very small part of the API is documented in openapi.yml . openapi.yml 中仅记录了API的一小部分。 There is an open issue that is tracking this improvement.有一个未解决的问题正在跟踪此改进。

For now, the online API docs are going to be your best source of information available on using the GitLab API.目前,在线API 文档将成为您使用 GitLab API 的最佳信息来源。

As for your problem of getting 404 responses, the most common cause of this is that the credentials you are using do not have permissions to the project/feature you are trying to access or you are not using a proper authentication method .至于您获得404响应的问题,最常见的原因是您使用的凭据对您尝试访问的项目/功能没有权限,或者您没有使用正确的身份验证方法 Also keep in mind some features of the API require an appropriate license entitlement.另请记住,API 的某些功能需要适当的许可权利。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM