GitHub API - How to add an admin collaborator?

被刻印的时光 ゝ 提交于 2021-02-07 20:38:00

问题


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

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.

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.

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

Ta.


回答1:


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



来源:https://stackoverflow.com/questions/40672144/github-api-how-to-add-an-admin-collaborator

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!