Metamodels
A model’s elements are of types defined by its metamodel (M2): element types, relationship types, the property types they carry, and the enumerations that some property types use. Before a program reads or reports on a model, it usually needs to know these.
| Call | Gives |
|---|---|
GET /v1/projects/{projectId}/metamodels |
The project’s metamodels, standard and common |
GET /v1/metamodels/{metamodelId} |
One metamodel, with its layers in the order the app shows them |
GET /v1/metamodels/{metamodelId}/element-types |
Every element type, layer by layer, with its property types |
GET /v1/metamodels/{metamodelId}/relationship-types |
Every relationship type, with its verbs and the element types it may join |
GET /v1/metamodels/{metamodelId}/enumerations |
Every enumeration, with its values in order |
Metamodels are read only in the API: they’re changed in the app, where the careful paths are (upgrades, value alignment, backups).
Included metamodels
Section titled “Included metamodels”A metamodel can be included from another project of the organisation: defined once there, and a read-only copy here that takes new versions when an admin accepts them (see How to share a metamodel between projects). Such a metamodel has included:
sourceProjectId: the project it is included from;originProjectId: the project that defines it. They differ when it comes through another project’s copy.versionandlabel: the published version it holds.state:upToDate;waiting(a newer version is published and not yet accepted);updating;failed(an update stopped part-way); orsourceGone(the project it came from no longer offers it).
included is null for the project’s own metamodels. Its types and values read as any other’s; their ids are this project’s.
A model can be included the same way. Its top-level package then has the same included field, every item in it has originUid (the original’s uid), and writes to it or to anything in it are refused with 403 forbidden. Relationships from the project’s own elements to its elements can be made as usual.
Property types
Section titled “Property types”Each element and relationship type lists its property types, its own and those it inherits from its superclasses, in the order the app shows them. For each:
dataType:String,Integer,Real,Boolean,Date,DateTime,UnlimitedNatural,Enumeration(thenenumerationnames which one) orElement(a reference to an element ofelementType).format: how a value is shown or entered, such asmultiline,url,email,richtext(Markdown),currency:NZDorpercent. New formats may appear; treat one you don’t know as plain text.multiplicity:lower1 or more means a value is required;uppernull means no limit.defaultValue, andinheritedFrom: the superclass it comes from, or null when it’s the type’s own.
What an element can have attached
Section titled “What an element can have attached”An element type’s attachment says what its elements may have attached: image (images only), file (any file), or null when they can’t have one. Check it before sending a file, rather than waiting for a 422.
Enumeration values
Section titled “Enumeration values”Each value has a name, as people see it, and a storedValue, which is what’s stored and never changes when the value is renamed. Match on storedValue in your program; show name to people.
Retired types and values
Section titled “Retired types and values”A type, property type or value can be retired by a metamodel upgrade: existing elements and values are kept, but nothing new should use it. retired then says since which metamodel version, and why if a reason was given; otherwise it’s null.
Valid pairs
Section titled “Valid pairs”A relationship type’s validPairs lists the element types it may join, source to target. A null end means any type, and validPairs: null means any pair at all. A subtype is accepted wherever its superclass is: check against an element type and its superclasses.