Skip to content

Match external terms against a target

POST
/models/{modelId}/external-terms/match
curl --request POST \
--url https://api.modeldesk.io/models/2489E9AD-2EE2-8E00-8EC9-32D5F69181C0/external-terms/match \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{ "targetModelId": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0", "targetDependencyId": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0" }'

Resolve every unresolved reference this model can account for against one target — the bulk sibling of the single-reference resolve at .../external-terms/{elementId}/rebind, sharing its rewiring and its authorization. The target is either a model the workspace hosts or an external dependency of the model, and the request names exactly one of the two. Each placeholder’s IRI is resolved against the target, every reference to a resolved placeholder is rewritten and the placeholder is deleted, all in a single commit. A hosted target that supplied one and was not yet a dependency is pinned in a commit of its own first; the two land together or neither does. Partial success is the normal outcome and reads as 200: the response reports every reference the run considered and what became of it, so a model drawing on several vocabularies is resolved by calling this once per vocabulary. Requires write access to the model and read access to the target. The path serves every metamodel whose unresolved references are reported (see GET /models/{modelId}/unresolved-references); on a metamodel nobody reports for it is a 404. An application profile resolves its rows in the context of the class each sits on and its run is followed by restatement normalization, which populates logEntries; every other metamodel resolves by IRI and checks the resolved element’s type against what the relations pointing at the placeholder admit, reporting a TYPE_MISMATCH rather than rewiring one that does not fit.

modelId
required
string format: uuid
Media typeapplication/json

The request to resolve every unresolved reference a model can account for against one target. Exactly one of targetModelId and targetDependencyId is required: they name the two kinds of thing a model can resolve against, and neither or both is refused rather than resolved by precedence.

object
targetModelId

The hosted model to resolve the references’ IRIs against: a vocabulary, or a parent profile. One target per run — the platform has no IRI search index, so the caller names the model expected to host the terms.

string format: uuid
targetDependencyId

An external dependency of this model, resolved against by the snapshot it holds. An address-fetched base is not a model the workspace hosts, so targetModelId cannot name it. The dependency exists by construction, so such a run creates none and reports dependencyCreated: false. An internal dependency is refused here — name the model it points at with targetModelId instead.

string format: uuid

Example generated

{
"targetModelId": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0",
"targetDependencyId": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0"
}

OK

Media typeapplication/json

What one resolve run did, reference by reference. Every placeholder the model held is reported, resolved or not: one left standing is not a failure but a term this target does not host, still there for the next run.

object
modelId
required

The model the run acted on.

string format: uuid
targetModelId

The hosted model its stand-ins were matched against; null when the run named a dependency instead.

string format: uuid
nullable
targetDependencyId

The external dependency whose snapshot they were matched against; null when the run named a hosted model. Exactly one of the two is set, echoing the request, so a reader never has to guess which kind of thing an id names.

string format: uuid
nullable
dependencyCreated
required

Whether the run added the dependency on the target model (or promoted an existing transitive edge to a direct one), so the client can refresh its dependency set without diffing. Always false for a dependency target, which is there by construction.

boolean
outcomes
required

One entry per stand-in considered, in the order the profile holds them.

Array<object>

What became of one placeholder in a resolve run.

object
externalTermId
required

The stand-in considered; gone from the model when status is MATCHED, still present otherwise.

string format: uuid
iri

The IRI it carried, absent only for NO_IRI.

string
nullable
status
required

MATCHED — rewired onto elementId. UNMATCHED — the target publishes nothing under this IRI; the placeholder remains, resolvable again later. AMBIGUOUS — the target publishes several elements under it, refused rather than resolved by picking. NO_IRI — the placeholder carries no IRI, so there is nothing to resolve it against. TYPE_MISMATCH — exactly one element is published under this IRI, but of a type no relation pointing at the placeholder admits; reported rather than rewired, since the reference would otherwise become one the metamodel forbids, and detail names the type found and the type expected. Only a generic (non-application-profile) run reports it.

string
Allowed values: MATCHED UNMATCHED AMBIGUOUS NO_IRI TYPE_MISMATCH
elementId

What it now refers to — a vocabulary element, or a row of a parent profile. Set for MATCHED, null otherwise.

string format: uuid
nullable
candidates
required

The elements that tied, for AMBIGUOUS; empty otherwise.

Array<string>
waitingOnElementId

The row of this profile whose own resolution would settle this one — set only for an UNMATCHED term left standing because the class row owning it has not resolved yet. Such a term needs nothing from the author: it resolves on a later run once its class does, which is a different thing to report than a term this target simply does not publish, and only the run itself can tell them apart. Null for every other outcome, and for a vocabulary target, which matches by IRI alone and so has no context to wait for.

string format: uuid
nullable
detail

Why, in the author’s terms, for every status but MATCHED.

string
nullable
logEntries
required

What restatement normalization dropped afterwards, one entry per removed facet. Empty outside an application profile, whose metamodel is the one that states restatement rules.

Array<object>
object
code
required
string
logLevel
required

INFO entries are informational — something the reader should know that is not a defect, notably the “unverifiable” verdicts of profile resolution. An INFO entry never makes a model invalid.

string
Allowed values: WARN ERROR INFO
title
required
string
detailMessage
required
string
modelElementId
string format: uuid
property
string
valueIndex
integer
otherElementId

The other element a finding is about, where it concerns two: the element whose key or value this one repeats, or the dependency element publishing the same IRI.

string format: uuid
fingerprint

A hash of the value the finding was about. Sent with modelElementId (as elementId, left out for a model-level finding), code and property to POST /models/{modelId}/dismissals to dismiss the finding; the dismissal holds while the value hashes the same.

string
dismissed

Who dismissed this warning or informational finding and when, where a dismissal of the model names it by element, code, property and fingerprint, so while the value it was about is unchanged. Never on an error, nor on a finding on an element another model answers for.

object
by
required

Who dismissed it: a person (USER) with their current name. name is absent where nothing answers to the id any more, such as an erased user.

object
id
required
string format: uuid
type
required

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.

string
Allowed values: USER ORGANIZATION SYSTEM MACHINE
name

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.

string
at
string format: date-time
subject

What exactly a finding is about, when its check can report more than one finding at the same code, element and property: a relation target, an offending value (with its language tag for a language string) or an identifier the check is about. Exactly one of target, value and name is present, language only beside value.

object
target
string format: uuid
value
string
language
string
name
string
key

The finding’s identity across validation runs: the lowercase hex SHA-256 of the canonical JSON of code, modelElementId (as elementId), property and subject, each left out when absent, keys sorted and no whitespace. Neither valueIndex nor the message is part of it. Present on every entry of a validation result.

string
/^[0-9a-f]{64}$/

Example

{
"outcomes": [
{
"status": "MATCHED"
}
],
"logEntries": [
{
"logLevel": "WARN",
"dismissed": {
"by": {
"type": "USER"
}
}
}
]
}

Bad request: neither or both target fields given, the target model does not exist or is not accessible, the target is the model itself, or the named dependency is not an external dependency of this model

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"
}
]
}

Not found — no such model, or unresolved references are not reported for its metamodel

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"
}
]
}

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"
}
]
}