GitHub API-如何添加管理员协作者? [英] GitHub API - How to add an admin collaborator?

查看:88
本文介绍了GitHub API-如何添加管理员协作者?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用github api(v3)使用我的帐户在组织中创建存储库.我是该组织的管理员.然后,我使用协作者端点添加具有管理员权限的协作者.我正在使用具有'repos'范围的oauth令牌进行身份验证;

I'm using the github api (v3) to create a repository in an organisation using my account. I am an admin of that organisation. I'm then using the collaborators endpoint to add a collaborator with admin permissions. I'm authenticating with an oauth token that has the 'repos' scope;

PUT /repos/:owner/:repo/collaborators/:username?permission=admin

哪个返回204,导致我认为PUT成功.但是,当我获得存储库协作者或使用github UI查看协作者时,我添加的用户只有写权限.

Which returns a 204 leading me to believe the PUT has been successful. However, when I get the repository collaborators, or view the collaborators using the github UI the user that I have added has only write permission.

如果我通过UI将用户设置为admin并获得存储库协作者,则该用户具有admin权限.如果我再次执行PUT,则用户将恢复为仅具有写权限.

If I set the user to be admin via the UI and get the repository collaborators then the user has admin permission. If I do the PUT again, the user reverts back to having only write permissions.

有人可以建议我在这里做错什么吗,或者这是GitHub API的问题?

Can anyone suggest what I may be doing wrong here or is this an issue with GitHub API?

Ta.

推荐答案

此处的答案是在正文中包括权限级别,而不是作为查询参数.

The answer here was to include the permission level in the body, rather than as a query param.

这篇关于GitHub API-如何添加管理员协作者?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆