Protected Branches API Becomes an Official Part of API v3
We're excited to announce that the Protected Branches API has graduated from preview mode. As of today, the Protected Branches API is an official part of the GitHub API v3—stable and suitable for production use.
Breaking changes
As announced in a previous blog post, you are now required to pass the required_pull_request_reviews
object when calling the update branch protection endpoint. Passing this object was optional during the preview period.
Also as previously announced, you are no longer able to call the PATCH /repos/:owner/:repo/branches/:branch
endpoint. Please make sure you are using PUT /repos/:owner/:repo/branches/:branch/protection
instead.
Additionally, you must now be a repository administrator to list protected branches.
Preview media type no longer required
If you used the Protected Branches API during the preview period, you needed to provide a custom media type in the Accept
header:
application/vnd.github.loki-preview+json
As of today, you no longer need to pass this custom media type. Instead, we recommend that you specify v3
as the version in the Accept
header:
application/vnd.github.v3+json
Onward!
Thanks to everyone who tried out the Protected Branches API during the preview period!
If you have any questions or feedback, please get in touch with us.