Branch API: Branch Names and Standard Error Codes

December 13, 2023

Branch Names in the Branch List

GET /api/branches/{org} lists your organization’s frozen and unfrozen projects. Each entry now includes:

  • branch_name: the branch, such as main, alongside the repository name. Before, you couldn’t tell two projects in the same repository apart.
  • url and details_url for every project. Before, frozen projects returned one URL and unfrozen projects returned the other.
{
  "frozen": [
    {
      "name": "my-repo",
      "branch_name": "main",
      "url": "...",
      "details_url": "...",
      "next_freeze_at": null,
      "next_unfreeze_at": null,
      "scheduled_freezes_enabled": true
    }
  ],
  "unfrozen": []
}

Standard Error Codes

The branch endpoints (GET and POST /api/branches/{org}/{repo}/{branch}) now return standard HTTP status codes instead of an error page:

SituationStatus
No access_token provided401 Unauthorized
Wrong access token403 Forbidden
Project not found (GET)404 Not Found
Project not found (POST)400 Bad Request

This changes one earlier behavior. In June we made a missing project return an empty response. A GET for a project that doesn’t exist now returns 404 instead. If your scripts check whether a project exists by looking for {}, check for a 404 instead.

Questions?

See the web API docs or reach out at hello@mergefreeze.com.