The GitHub API is inconsistent for this endpoint. Normally to edit or modify a resource, the REST API uses the PATCH
verb.
For the https://developer.github.com/v3/repos/collaborators/ endpoint however, to edit or modify a user's permissions,
there is no PATCH
verb. Instead you must make a PUT
call defining the new permissions.
The documentation confusingly describes this as "Add user as a collaborator" when the user you're modifying already is a collaborator, you just want to change their permissions.
Here is an example call to change a user with push
permissions to pull
permissions
curl -v -H "Authorization: token TOKEN" https://api.github.com/repos/OWNER/REPO/collaborators/COLLABORATOR -X PUT -d '{"permission":"pull"}'
I learned this from a response from GitHub support.
Boom, thank you!! This saved me much head scratching. :)