You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Nov 1, 2017. It is now read-only.
Copy file name to clipboardExpand all lines: content/changes/2015-11-11-protected-branches-api.md
+3-1Lines changed: 3 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -3,6 +3,8 @@ title: Protected Branches API Preview Period
3
3
author_name: nakajima
4
4
---
5
5
6
+
**UPDATE (2016-06-27):** As [announced](/changes/2016-06-27-protected-branches-api-update/), there is an extended version of the protected branches API available. This older version will be removed once the new one becomes official.
7
+
6
8
We're starting a preview period for the [protected branches](https://github.com/blog/2051-protected-branches-and-required-status-checks) API. Protecting a branch prevents force-pushes to it as well as deleting it. You can also specify required status checks that are required to merge code into the branch.
7
9
8
10
To protect a branch, make a `PATCH` request to the URL of the branch:
@@ -33,6 +35,6 @@ To access this functionality during the preview period, you’ll need to provide
33
35
application/vnd.github.loki-preview+json
34
36
```
35
37
36
-
Take a look at [the docs here](/v3/repos/#enabling-and-disabling-branch-protection).
38
+
Take a look at [the docs here](/v3/repos/branches/).
37
39
38
40
If you have any questions, please [get in touch](https://github.com/contact?form%5Bsubject%5D=Protected+Branches+API+Preview).
Over the past few months, we've made a few [improvements](https://github.com/blog/2137-protected-branches-improvements) to the way [protected branches](https://github.com/blog/2051-protected-branches-and-required-status-checks) work in our web interface. Today, we're modifying the protected branches API [preview period](https://developer.github.com/changes/2015-11-11-protected-branches-api/) to include these improvements.
7
+
8
+
Included in these API changes is the ability to allow organizations to specify which members and teams should be able to push to a protected branch, as well as providing a new setting for required status checks which will remove the requirement of a pull request to be up to date before merging.
9
+
10
+
You'll notice a new endpoint structure. One set of endpoints for modifying the branch settings as a whole (`PATCH /repos/:owner/:repo/branches/:branch` has been updated to be `PUT /repos/:owner/:repo/branches/:branch/protection`), and a series of more granular endpoints to modify a subset of the branch protection settings.
11
+
12
+
**This will be a breaking change for the protected branch API.** The deprecated API endpoint will be removed when the protected branches API will leave the preview period. If you're trying out the old protected branches API, you'll need to update your code.
13
+
14
+
#### How can I try it?
15
+
16
+
To access this functionality during the preview period, you’ll need to provide the following custom media type in the Accept header:
17
+
18
+
```
19
+
application/vnd.github.loki-preview+json
20
+
```
21
+
22
+
Take a look at [the docs here](/v3/repos/branches/). If you have any questions, please [get in touch](https://github.com/contact?form%5Bsubject%5D=Protected+Branches+API+Preview).
0 commit comments