RESTv3 documentation for repos/:o/:r/branches

$ curl -H “Authorization: token $(<~/.ghtoken)” https://api.github.com/repos/owner/repo/branches

[

  {

    “name”: “xxx”,

    “commit”: {

      “sha”: “0989xxxxxxx”,

      “url”: “https://api.github.com/repos/…”

    }

  },

]

Not a single result shows either “protected”, or “protected_url” fields despite there being branch protection configured for some branches.  Am I missing a mediatype for the API?  The documentation (https://developer.github.com/v3/repos/branches/#list-branches) does not specify one.

I started looking at this because I was unable to get the branch protection for a wildcard branch created with the UI although when checking a branch matching the wildcard, I was able to see the correct protection, but no indication that it was created using a wildcard.  Are wildcards unsupported in the REST v3 API at the moment?

1 Like

Aha, I see that protected, protection_url and the undocumented “protection” are returned but only if you specify protected=true.  That’s not as intuitive as I’d hope.  The question about wildcards still stands, however.

Thanks.

1 Like