获取 GitHub Branch 保护返回“404 Not Found”

Cal*_*oju 3 api rest curl github postman

我尝试使用curl / Postman 获取分支策略,但是我不断收到错误“404 Not Found”。 在此输入图像描述

根据文档(https://docs.github.com/en/rest/reference/repos#get-branch-protection),我似乎使用了正确的 API Uri。请参阅下面使用的命令。Ps:Auth Token已被验证。

对于卷曲:

curl \
-H "Accept: application/vnd.github.v3+json" \
https://api.github.com/repos/{owner}/{repo}/branches/{branch}/protection
Run Code Online (Sandbox Code Playgroud)

邮差:

https://api.github.com/repos/{owner}/{repo}/branches/{branch}/protection
Run Code Online (Sandbox Code Playgroud)

我需要 API 调用来返回分支保护。谢谢!

小智 5

虽然目前没有明确记录,但此 API URI 需要提供的访问令牌才能拥有存储库的管理员权限。