Help
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Copilot Lvl 2
Message 1 of 3

GET branch protection returning 404

Solved! Go to Solution.

I'm trying to use the Github API to look at branch protection on a public repo.

I'm doing a GET request (via Postman but also tried via curl) to the following:
https://api.github.com/repos/JoPintoPaul/xml-spike/branches/master/protection

 

With the headers: 

Accept: application/vnd.github.luke-cage-preview+json
Accept: application/vnd.github.zzzax-preview+json

 

However, I keep getting the following 404 response:

{
    "message": "Not Found",
    "documentation_url": "https://developer.github.com/v3/repos/branches/#get-branch-protection"
}


Anyone got any ideas?

2 Replies
Highlighted
Solution
Pilot Lvl 1
Message 2 of 3

Re: GET branch protection returning 404

@JoPintoPaul 

 

Can you check whether the user is an admin for that repo?  Or is he in a team that has admin access to the repo? Because branch protection is something that is restricted.

 

In the below example you can see that I can able to get the master branch details but I cannot get the branch protection details since I am not the admin for that repo.

 

Screen Shot 2020-03-11 at 2.04.54 PM.png

 

Regards

Parithiban G

 

 

Highlighted
Copilot Lvl 2
Message 3 of 3

Re: GET branch protection returning 404

Yes, my mistake, I didn't realise that just viewing branch protection required authorized user. Issue resolved now.