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
type GetGitBranchesMapping = {
mapping: {
gitBranch: string;
xataBranch: string;
}[];
};
type GetGitBranchesMapping = {
id?: string;
message: string;
};
{
"message": "invalid API key"
}
type GetGitBranchesMapping = void;
type GetGitBranchesMapping = void;
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
type AddGitBranchesEntry = {
/**
* The name of the Git branch.
*/
gitBranch: string;
/**
* The name of the Xata branch.
*/
xataBranch: BranchName;
};
/**
* @maxLength 255
* @minLength 1
* @pattern [a-zA-Z0-9_\-~]+
*/
type BranchName = string;
Responses
{
"warning": "Git branch [fix/bug123] was already present in the mapping and was overwritten."
}
type AddGitBranchesEntry = void;
type AddGitBranchesEntry = {
id?: string;
message: string;
};
{
"message": "invalid API key"
}
type AddGitBranchesEntry = void;
type AddGitBranchesEntry = void;
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 |
Responses
type RemoveGitBranchesEntry = void;
type RemoveGitBranchesEntry = {
id?: string;
message: string;
};
{
"message": "invalid API key"
}
type RemoveGitBranchesEntry = void;
type RemoveGitBranchesEntry = void;
type RemoveGitBranchesEntry = void;