Rebase your dataset draft
const url = 'https://api.modeldesk.io/datasets/2489E9AD-2EE2-8E00-8EC9-32D5F69181C0/draft/rebase';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"draftHeadId":"2489E9AD-2EE2-8E00-8EC9-32D5F69181C0","drop":["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/draft/rebase \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "draftHeadId": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0", "drop": [ "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0" ] }'Replay the caller’s staged changes onto the current head of the branch their draft targets and move the draft there. Replaying mints nothing: a staged change points at the same row revisions on the new base. It does judge them again: each change the rebase keeps is re-staged, its rows judged against the branch as it now stands and the changes replayed before it, and the answer’s flagged names the rows that judgement flags which the draft did not flag before. A row that no longer conforms is not a conflict; it moves with the draft, flagged.
A change that touched a row the branch has changed since is a conflict; the whole rebase is then refused with 409, nothing is written, and each conflict names the rows in dispute. Name a change in drop to leave it out on the next call. A draft already on the branch head with nothing to drop is answered as it stands.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”Request Bodyrequired
Section titled “Request Bodyrequired”What rebasing a draft takes: the head the caller believes it is rewriting, and the staged changes it wants left out.
object
The draft head the caller believes it is rewriting, compared before anything is replayed. Required, because a rebase rewrites the whole chain and must not race a session that is still staging into it.
The ids of the staged changes to leave out, each one a commit of the draft’s own chain. An id the chain does not hold is a 400 rather than an id quietly ignored. Absent means empty: the ordinary rebase drops nothing.
Example generated
{ "draftHeadId": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0", "drop": [ "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0" ]}Responses
Section titled “Responses”The draft now stands on the branch head
Where a rebased dataset draft now stands, the staged changes left out of it, and the rows the replay newly flags.
object
One user’s private staging ref on a branch of the model. updatedAt is derived rather than stored: the newer of the draft’s creation and its head commit, so it moves with every staged change.
object
The draft’s ref id, which is also what ?ref= takes on the read routes.
The branch the draft lands on.
The target branch’s head the draft started from.
The draft’s own head, equal to the baseline while nothing is staged.
How many changes are staged: the length of the draft’s chain from its head down to its baseline. Computed per read rather than stored, and 0 on a draft nothing has been staged into. A change is the undo grain, so five edits to one element count as five.
For a dataset draft that moves the dataset to another release of its base, that release’s name; the dataset is pinned to it once the draft lands.
A draft’s most recent handoff for review, set by POST /models/{modelId}/draft/handoff. Absent on a draft never handed off. Neither a commit nor a staged change: it goes with the draft when the draft is committed or discarded, and a staged change, an undo or a rebase leaves it in place.
object
The author’s own words about the draft. Written by whoever handed it off, often an agent, so a client renders it as plain text and never as markup.
The draft head when it was handed off. A headCommitId on the draft other than this one means the draft changed after the handoff.
When the draft was handed off.
The changes the caller named in drop, in chain order; empty when none was. Each is the staged change as the dataset’s history lists a commit, its requestId the changeRequestId it was staged under and its rowsChanged the rows that change alone touched.
One commit of a dataset’s history. What a commit points at stays opaque; how many rows it touched is what a reader wants from it. This is the shape every route but the history reads carries (a landing’s answer, a stale head’s gap, a rebase’s dropped changes); the listing adds the size of a landing’s record (DatasetCommitLogView) and the single read the record itself (DatasetCommitRecordView).
object
None for the first commit, one for an ordinary one, two for a merge.
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.
What the commit records about the change. Absent on a staged change sent without one.
How many rows the commit wrote or removed. For a change staged on a draft, listed in a stale head’s gap or among a rebase’s dropped changes, the rows that one change touched.
Row id to what is wrong with it, for the rows the replay judged not to conform that the draft did not flag before. Absent when there are none.
object
How a row stands against its dataset’s data schema. A row that does not conform is flagged and kept, never dropped: reference data arrives incomplete and is corrected in place.
object
Whether no violation is an error. A row whose violations are all warnings is valid and still carries them.
Absent when nothing is wrong with the row.
One way in which a row does not conform.
object
The schema property’s source element id — the same key the row’s own maps use, so a caller marks the offending cell without a lookup. Absent for a violation about the row itself. For a violation inside a part, the row’s column that holds the part, with path leading from there to the field.
Which value of the property; absent when the violation is the property’s as a whole. For a violation inside a part, which value of the field path ends at.
For a violation inside a part, the way from propertyId down to the field, outermost part first: contactpunt[2].email is one step, the part at index 1 and its property email. Absent for a violation of one of the row’s own fields.
One step of a violation’s way into a part: the part at a position among the parts of the property reached so far, and the property of that part the way goes on to.
object
The part’s position among that property’s parts, from 0.
The part’s property the way goes on to; absent where the violation is about the part.
How much the violation weighs; the row is kept and flagged either way. A value outside a code list is a WARNING unless the list is marked strict; everything else is an ERROR.
For a reference property, which of its lists the violation is about: true for its references to models, model elements and datasets (platformRefs), which valueIndex then counts in; false for its references to rows (refs) where that needs saying beside the other. Absent for its references to rows, as every violation from before the other list existed reads. Inside a part as at the row: beside path, it says which list of the field path ends at.
Example
{ "dropped": [ { "createdBy": { "type": "USER" } } ], "flagged": { "additionalProperty": { "violations": [ { "code": "TOO_FEW_VALUES", "severity": "WARNING" } ] } }}drop names a change the draft has not staged, or the branch has moved too far past the draft’s baseline to be 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 generated
{ "type": "https://example.com", "title": "example", "status": 1, "detail": "example", "instance": "example", "violations": [ { "property": "example", "message": "example" } ]}The dataset is theirs to read but not to change.
A Problem answered when an organization feature the request needs is not open to the caller on this resource. A 403, as an access refusal is, and told apart from one by its type: a caller refused a feature can still read the resource, and only loses what the feature offers. feature says which: on a draft route it is a feature an action inside the staged change needs, such as alignment for an ALIGNMENT_CREATE, and only that change is refused.
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 403 from an access refusal.
The organization feature the caller lacks, spelled as it is on the organization, such as alignment or catalog. Where any of several features would admit the caller, the first of them is named.
The organization the refusal was judged against. Absent for a resource no organization owns (one a user owns, or one nobody owns), which no organization feature can open: the refusal then names no one.
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/feature-not-enabled", "feature": "alignment"}The dataset does not exist, answered with the plain problem, or the caller holds no draft on it, answered as RefNotFoundProblem: to a client that is the news a read at a gone ref brings, that the draft it was working in, perhaps committed or discarded in another session, is no longer there.
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"}Either staged changes collide with rows the branch has changed, in which case the problem names every colliding change and its rows and nothing was written, or the draftHeadId is no longer the draft’s head, in which case it carries the gap exactly as a refused change does. The two are told apart by type.
A third shape carries neither, under a type of its own. The swap’s own compare-and-set can still lose to a change staged while the replay was running, and that answers the BranchHeadConflictProblem: conflict and no gap, whose branchId is the draft’s own ref id. The draft still holds its old chain.
A Problem answered when a dataset draft’s rebase met staged changes that touch rows the branch has changed since, and that the caller had not asked to drop. Nothing was written and nothing was swapped. Every refusal rides at once.
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
One entry per staged change that could not be replayed, in chain order.
One staged change a dataset draft’s rebase could not replay, and the rows in dispute.
object
The staged change that was refused, and the id to put in drop to leave it out.
The changeRequestId the change was staged under.
Why the change was refused, in words a caller can show. Reworded freely, never parsed.
The rows the change touched that the branch has changed since, sorted.
A Problem that additionally carries the gap, answered when the draftHeadId a dataset draft write was written against is no longer the current head, and when a landing finds the branch moved past the draft’s baseline. It is the model’s DraftHeadConflictProblem with the gap in the dataset’s own words: each commit as the dataset’s history lists one, counting the rows its own change touched.
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
object
The ref the head belongs to: the caller’s draft, or the branch it targets while there is none and when a landing is refused.
The head the caller sent, which is no longer the current one; for a refused landing, the baseline the draft is still based on.
The head as it now stands.
Whether the head the caller sent is still on the chain below the current one. False when an undo popped it or a rebase rewrote the chain; a client that reads false re-reads the draft.
The chain from the current head down to the head the caller sent, exclusive, newest first. Absent when ancestor is false.
One commit of a dataset’s history. What a commit points at stays opaque; how many rows it touched is what a reader wants from it. This is the shape every route but the history reads carries (a landing’s answer, a stale head’s gap, a rebase’s dropped changes); the listing adds the size of a landing’s record (DatasetCommitLogView) and the single read the record itself (DatasetCommitRecordView).
object
None for the first commit, one for an ordinary one, two for a merge.
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.
What the commit records about the change. Absent on a staged change sent without one.
How many rows the commit wrote or removed. For a change staged on a draft, listed in a stale head’s gap or among a rebase’s dropped changes, the rows that one change touched.
A Problem answered when a gated write lost its compare-and-set: the head the write was written against was no longer the ref’s head when the write reached it, so nothing was written. It names the ref and the two heads, and carries no gap.
It stands in for DraftHeadConflictProblem where the gap cannot be walked: a landing whose draft was discarded while the refusal was being built, and a rebase whose swap lost to a change staged while the replay was running. On a rebase the conflict.branchId is the draft’s own ref id rather than the branch it targets, because the ref that moved is the draft.
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 409 from the others the same routes answer with.
Always the sentence Branch HEAD has advanced since this commit's baseline., whichever ref moved. What a human reads, never parsed.
object
The ref whose head the write was gated on.
The head the write was written against, which is no longer the current one.
The head as it now stands. Absent when the follow-up read that fills it found no ref, which is what a discarded draft leaves behind.
Example
{ "type": "https://modeldesk.io/problems/rebase-conflict"}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" } ]}