Create a dataset branch
const url = 'https://api.modeldesk.io/datasets/2489E9AD-2EE2-8E00-8EC9-32D5F69181C0/branches';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"name":"example","from":"2489E9AD-2EE2-8E00-8EC9-32D5F69181C0"}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://api.modeldesk.io/datasets/2489E9AD-2EE2-8E00-8EC9-32D5F69181C0/branches \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "name": "example", "from": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0" }'Create a branch at the current head of another branch of the dataset, main when from is omitted. The new branch holds the rows that head holds, so reading the dataset’s rows with the branch’s name as ref answers what the source held. The name keeps the rules a model branch’s name keeps.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”Request Bodyrequired
Section titled “Request Bodyrequired”What creating a branch takes. Nothing in it is required by the schema, so that every bad name, a missing one too, is refused with InvalidBranchNameProblem naming its rule.
object
The new branch’s name, brought to Unicode’s composed form (NFC) and trimmed before it is checked and stored. It must then be 1 to 100 characters long, hold no control character, invisible formatting character, line break or character Unicode does not assign, not be main in any case, and not start with draft/ or gen/. A missing name is refused as empty, as an empty one is. It must differ from every other branch’s name in more than case.
The branch whose current head the new branch starts at. Omitted means the model’s main branch.
Example generated
{ "name": "example", "from": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0"}Responses
Section titled “Responses”Created
One branch of a model: its name, when it was created, whether it is the model’s main branch, the commit it points at and who made that commit, how many drafts target it and how many of its commits main does not reach.
object
The branch’s ref id, which is what ?ref= takes on the read routes and branchId on a staged change.
The name the branch was created with. A branch is never renamed.
True for the model’s main branch only: the one every read without a ref reads, the one releases are cut from, and the one that cannot be deleted.
The commit the branch points at, in the shape a walked commit is listed in.
object
Absent on the initial commit.
The author’s description of the change. Absent on a commit made without one. For a staged change it is the message that was sent, absent when it was blank or left out.
The key of the request that produced the commit, absent on a commit made without one. For a staged change it is the changeRequestId that was sent.
The deduped, sorted type values of the commit’s actions. Empty rather than absent on a commit that records none.
Present, and true, on a merge commit whose actionTypes include a dependency or metamodel-pin type for every change it made to the model’s dependencies and metamodel pin. A merge commit names the elements it changed as element actions whatever they are, so one without it says nothing about those: a client has to assume they may have moved. Absent on every other commit, whose actionTypes always tell.
Who made the head commit, named as the commit log names the author of the same commit in createdBy: a person by the name on their account, a service account by the name it had when it committed, and the platform (SYSTEM) without a name.
object
USER is a person, MACHINE a service account, and SYSTEM the platform itself, whose commits (metamodel seeding and re-pins) the commit log hides unless asked for them.
The display name, where one is known: a person’s from their account, a service account’s as stored with what it wrote. Left out for the platform and for a person whose account holds no name.
How many drafts target the branch, whoever owns them. Deleting the branch deletes every one of them, so a client can say how many go before it asks.
How many commits on the branch main does not reach, every parent of a merge followed. Zero for main and for a branch main has merged. Deleting the branch leaves them to garbage collection and is refused without force while there are any, so a client can say how many go before it asks.
Example
{ "headAuthor": { "type": "USER" }}The name breaks one of the rules a branch name keeps, answered as InvalidBranchNameProblem with the rule it broke.
A Problem answered when a branch name breaks one of the rules a branch name keeps. Only the first broken rule is named.
object
Present only on a typed refusal, whose own schema requires it and fixes its value. An untyped problem omits it, which RFC 9457 defines as about:blank: the status and title are all there is to branch on.
The path of the request that was refused. Absent when the request was refused before it reached the application’s handlers: a 401 for a missing or unusable access token, and a 403 for a service account whose scopes do not reach the route.
Present on a 400 raised by request-body validation, and on a 422 that refuses named fields (a malformed slug or namespace prefix). Each entry names the rejected property, so a client can attach the message to the field that caused it rather than showing one error for the whole form.
object
Stable constant a client branches on, which is what tells this 400 from the plain one a body that cannot be read is refused with.
The rule the name broke. empty: missing, or nothing is left once it is trimmed. too-long: over 100 characters once composed and trimmed. control-character: it holds a control character, an invisible formatting character such as a bidi override or a zero-width space, a line or paragraph separator, a code point Unicode does not assign, or half of a surrogate pair. reserved-prefix: it starts with draft/ or gen/. reserved-name: it is main, in any case.
An RFC 9457 problem document, always sent as application/problem+json.
object
Present only on a typed refusal, whose own schema requires it and fixes its value. An untyped problem omits it, which RFC 9457 defines as about:blank: the status and title are all there is to branch on.
The path of the request that was refused. Absent when the request was refused before it reached the application’s handlers: a 401 for a missing or unusable access token, and a 403 for a service account whose scopes do not reach the route.
Present on a 400 raised by request-body validation, and on a 422 that refuses named fields (a malformed slug or namespace prefix). Each entry names the rejected property, so a client can attach the message to the field that caused it rather than showing one error for the whole form.
object
Example
{ "type": "https://modeldesk.io/problems/invalid-branch-name", "rule": "empty"}The dataset is theirs to read but not to change.
An RFC 9457 problem document, always sent as application/problem+json.
object
Present only on a typed refusal, whose own schema requires it and fixes its value. An untyped problem omits it, which RFC 9457 defines as about:blank: the status and title are all there is to branch on.
The path of the request that was refused. Absent when the request was refused before it reached the application’s handlers: a 401 for a missing or unusable access token, and a 403 for a service account whose scopes do not reach the route.
Present on a 400 raised by request-body validation, and on a 422 that refuses named fields (a malformed slug or namespace prefix). Each entry names the rejected property, so a client can attach the message to the field that caused it rather than showing one error for the whole form.
object
Example generated
{ "type": "https://example.com", "title": "example", "status": 1, "detail": "example", "instance": "example", "violations": [ { "property": "example", "message": "example" } ]}The dataset does not exist or is not the caller’s to read, answered with the plain problem, or from names no branch of it, answered as RefNotFoundProblem. A draft is not a branch, so naming one reads as naming nothing.
A Problem answered when a ref the request reads at is not there for the caller, on a resource they may read: a ref id that names nothing, a ref of another resource, and another user’s draft, which reads exactly as a ref that does not exist. The draft routes answer it too when the caller holds no draft.
A 404, as a missing resource is, and told apart from one by its type. A resource the caller cannot read keeps the plain answer it always had, whatever ref was named, so this one never says anything about a resource the caller could not see. To a client it means that the ref it was reading, typically a draft committed or discarded in another session, is gone while the resource stays: it goes back to the branch. The problem names no ref, so the answer for an id that names nothing and for another user’s draft is the same, byte for byte.
object
Present only on a typed refusal, whose own schema requires it and fixes its value. An untyped problem omits it, which RFC 9457 defines as about:blank: the status and title are all there is to branch on.
The path of the request that was refused. Absent when the request was refused before it reached the application’s handlers: a 401 for a missing or unusable access token, and a 403 for a service account whose scopes do not reach the route.
Present on a 400 raised by request-body validation, and on a 422 that refuses named fields (a malformed slug or namespace prefix). Each entry names the rejected property, so a client can attach the message to the field that caused it rather than showing one error for the whole form.
object
Stable constant a client branches on, which is what tells this 404 from a resource that is missing or not the caller’s to read.
An RFC 9457 problem document, always sent as application/problem+json.
object
Present only on a typed refusal, whose own schema requires it and fixes its value. An untyped problem omits it, which RFC 9457 defines as about:blank: the status and title are all there is to branch on.
The path of the request that was refused. Absent when the request was refused before it reached the application’s handlers: a 401 for a missing or unusable access token, and a 403 for a service account whose scopes do not reach the route.
Present on a 400 raised by request-body validation, and on a 422 that refuses named fields (a malformed slug or namespace prefix). Each entry names the rejected property, so a client can attach the message to the field that caused it rather than showing one error for the whole form.
object
Example
{ "type": "https://modeldesk.io/problems/ref-not-found"}Another branch of the dataset already has this name, compared without regard to case, answered as BranchNameTakenProblem; or the dataset already holds as many branches as one may, answered as BranchLimitReachedProblem with the limit. Nothing was created.
A Problem answered when another branch of the model already has the name a new branch asked for, compared without regard to case. The name is well formed; picking another one is all it takes.
object
Present only on a typed refusal, whose own schema requires it and fixes its value. An untyped problem omits it, which RFC 9457 defines as about:blank: the status and title are all there is to branch on.
The path of the request that was refused. Absent when the request was refused before it reached the application’s handlers: a 401 for a missing or unusable access token, and a 403 for a service account whose scopes do not reach the route.
Present on a 400 raised by request-body validation, and on a 422 that refuses named fields (a malformed slug or namespace prefix). Each entry names the rejected property, so a client can attach the message to the field that caused it rather than showing one error for the whole form.
object
Stable constant a client branches on.
A Problem answered when a model already holds as many branches as one model may, main included. Nothing was created; deleting a branch makes room.
object
Present only on a typed refusal, whose own schema requires it and fixes its value. An untyped problem omits it, which RFC 9457 defines as about:blank: the status and title are all there is to branch on.
The path of the request that was refused. Absent when the request was refused before it reached the application’s handlers: a 401 for a missing or unusable access token, and a 403 for a service account whose scopes do not reach the route.
Present on a 400 raised by request-body validation, and on a 422 that refuses named fields (a malformed slug or namespace prefix). Each entry names the rejected property, so a client can attach the message to the field that caused it rather than showing one error for the whole form.
object
Stable constant a client branches on.
How many branches one model may hold, main included.
Example
{ "type": "https://modeldesk.io/problems/branch-name-taken"}default
Section titled “default”Error
An RFC 9457 problem document, always sent as application/problem+json.
object
Present only on a typed refusal, whose own schema requires it and fixes its value. An untyped problem omits it, which RFC 9457 defines as about:blank: the status and title are all there is to branch on.
The path of the request that was refused. Absent when the request was refused before it reached the application’s handlers: a 401 for a missing or unusable access token, and a 403 for a service account whose scopes do not reach the route.
Present on a 400 raised by request-body validation, and on a 422 that refuses named fields (a malformed slug or namespace prefix). Each entry names the rejected property, so a client can attach the message to the field that caused it rather than showing one error for the whole form.
object
Example generated
{ "type": "https://example.com", "title": "example", "status": 1, "detail": "example", "instance": "example", "violations": [ { "property": "example", "message": "example" } ]}