Mapping of git to Xata branches
https://{your-workspace-slug}.{region}.xata.sh/dbs/db_name/gitBranches
This path allows managing the mapping between git and Xata branches, which is used by the `/dbs/{db_name}/resolveBranch` endpoint to resolve git branches to the associated Xata branches.
Expected parameters
Name | Description | In | Required | Schema |
---|---|---|---|---|
db_name | The Database Name | path | ✅ | string |
List Git Branches Mapping
GEThttps://{your-workspace-slug}.{region}.xata.sh/dbs/db_name/gitBranches
Lists all the git branches in the mapping, and their associated Xata branches.
Example response:
{ "mappings": [ { "gitBranch": "main", "xataBranch": "main" }, { "gitBranch": "gitBranch1", "xataBranch": "xataBranch1" } { "gitBranch": "xataBranch2", "xataBranch": "xataBranch2" } ] }
Responses
Link a Git Branch to a Xata Branch
POSThttps://{your-workspace-slug}.{region}.xata.sh/dbs/db_name/gitBranches
Adds an entry to the mapping of git branches to Xata branches. The git branch and the Xata branch must be present in the body of the request. If the Xata branch doesn't exist, a 400 error is returned.
If the git branch is already present in the mapping, the old entry is overwritten, and a warning message is included in the response. If the git branch is added and didn't exist before, the response code is 204. If the git branch existed and it was overwritten, the response code is 201.
Example request:
// POST https://tutorial-ng7s8c.xata.sh/dbs/demo/gitBranches { "gitBranch": "fix/bug123", "xataBranch": "fix_bug" }
Request Body Type Definition
Responses
Unlink a Git Branch to a Xata Branch
DELETEhttps://{your-workspace-slug}.{region}.xata.sh/dbs/db_name/gitBranches
Removes an entry from the mapping of git branches to Xata branches. The name of the git branch must be passed as a query parameter. If the git branch is not found, the endpoint returns a 404 status code.
Example request:
// DELETE https://tutorial-ng7s8c.xata.sh/dbs/demo/gitBranches?gitBranch=fix%2Fbug123
Expected parameters
Name | Description | In | Required | Schema |
---|---|---|---|---|
gitBranch | The git branch to remove from the mapping | query | ✅ | string |