Skip to content

Review your draft's changes

GET
/models/{modelId}/draft/diff
curl --request GET \
--url https://api.modeldesk.io/models/2489E9AD-2EE2-8E00-8EC9-32D5F69181C0/draft/diff \
--header 'Authorization: Bearer <token>'

Review the caller’s own staged work: the element-level difference between the baseline the draft was started from and where the draft now stands, in the same shape a commit’s diff is rendered in. commitId is the draft’s head and parentCommitId its baseline.

The element set is the net difference between the two states, not the union of what each staged change recorded: five edits to one element are one entry, and an element created and then deleted within the draft is no entry at all. A draft with nothing staged answers a diff with no elements; a caller who holds no draft is answered 404.

The raw revisions are not repeated here; GET /models/{modelId}/delta?ref={draftId}&baseline={baselineCommitId} already serves them.

modelId
required
string format: uuid

OK

Media typeapplication/json
object
commitId
required
string format: uuid
parentCommitId

Null for initial commits.

string format: uuid
elements
required
Array<object>
object
elementId
required
string format: uuid
elementName

Element name resolved at commit time.

string
elementType
required
string
diffType
required
string
Allowed values: ADDED MODIFIED REMOVED
attributes

Changed attributes only.

object
key
additional properties
object
before

Attribute values before the change. Null for ADDED elements.

Array
after

Attribute values after the change. Null for REMOVED elements.

Array
relations

Changed relations only.

object
key
additional properties

One relation that differs between the two states. before and after carry the relation whole, so a reader can show the targets it kept beside the ones it gained or lost, and a relation whose targets were only reordered differs in them alone. An empty list is omitted: an ADDED element’s relation carries no before, a REMOVED element’s no after.

object
before

Element IDs of the relation’s targets before the change, in order.

Array<string>
after

Element IDs of the relation’s targets after the change, in order.

Array<string>
addedTargets

Element IDs of newly added relation targets.

Array<string>
removedTargets

Element IDs of removed relation targets.

Array<string>
resolvedNames

Display label by element ID for every element the diff names: each entry, every target a changed relation holds before or after the change, and the elements its diagram actions name. An element neither state nor the current model holds is left out.

object
key
additional properties
string

Example

{
"elements": [
{
"diffType": "ADDED"
}
]
}

The model is not the caller’s to read. Or the caller is an agent acting for a person, and the organization that owns the model has not enabled the agent’s AI platform, answered as AgentPlatformNotEnabledProblem.

Media typeapplication/problem+json
Any of:

A Problem answered when an agent acting for a person reached a model whose owning organization has not enabled the AI platform the agent runs on, which its token names. Model content reaches the platform an agent runs on, so the organization decides: until an organization admin turns the platform on in the organization’s AI agent platforms setting, every route on the model refuses the agent, conditional reads and the events stream included, and the model list and every page that names other models leave the organization’s models out. A change of the setting applies to new requests within a minute; an events stream that is already open ends at its token’s expiry, at most ten minutes later.

object
type
required

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.

string format: uri
title
required
string
status
required
integer
detail
required
string
instance

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.

string
violations

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.

Array<object>
object
property
required
string
message
required
string
type
required

Stable constant a client branches on, which is what tells this 403 from the plain one the same routes answer for a model the caller may not read.

string format: uri
Allowed values: https://modeldesk.io/problems/agent-platform-not-enabled

Example

{
"type": "https://modeldesk.io/problems/agent-platform-not-enabled"
}

The model 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.

Media typeapplication/problem+json
Any of:

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
type
required

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.

string format: uri
title
required
string
status
required
integer
detail
required
string
instance

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.

string
violations

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.

Array<object>
object
property
required
string
message
required
string
type
required

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.

string format: uri
Allowed values: https://modeldesk.io/problems/ref-not-found

Example

{
"type": "https://modeldesk.io/problems/ref-not-found"
}

Error

Media typeapplication/problem+json

An RFC 9457 problem document, always sent as application/problem+json.

object
type

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.

string format: uri
title
required
string
status
required
integer
detail
required
string
instance

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.

string
violations

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.

Array<object>
object
property
required
string
message
required
string

Example generated

{
"type": "https://example.com",
"title": "example",
"status": 1,
"detail": "example",
"instance": "example",
"violations": [
{
"property": "example",
"message": "example"
}
]
}