Up - API Reference - Home
A definition is used to specify a record's fields, their layout in the user interface, and the preferred definition hierarchy.
There are two types of definitions, base definitions and extended definitions. The extended definitions are a copy of a base definition, with extra classes or fields added. When the base definition changes, those changes are propagated to the extended definitions.
Fields can be added individually, or as a set of fields (a class), making it easier to add the same set of fields to multiple definitions. If an added field happens to be part of an added class too, that is no problem, the data is just saved one time.
Child definitions are used when you create a child record - if there were no child records before, the first child definition is used for the new record (otherwise, it will use the definition that is assigned to the existing first child).
The returned dictionary with definitions uses the global identifier (gid
) as a key.
When you make changes to a base definition, you'll get a working copy. This is a temporary work in progress, where you make changes to a base definition without committing them yet (the original base definition is still active, and users will not see the work-in-progress changes yet). Once you're happy with the updated definition, you can commit it (updating all extended definitions), or save it as a new definition, that can then be used by other records and definitions. If you're unhappy instead, you can revert it and you'll get the unmodified base definition again.
{
…,
"data": {
"definitions": {
"c363cd4b-d862-4295-8869-5cb8ec108c88": {
"gid": "c363cd4b-d862-4295-8869-5cb8ec108c88",
"original": "14dabfb2-0975-4afd-8f6d-93fa39af434a",
"name": "STN_article",
"label": {
"nl": "Artikel",
"en": "Article"
},
"classes": [
"dc9b9ee7-ba69-40fc-b39d-c4e78ade64c1",
"0fce0db6-f7c0-4c5d-8c3c-25018e7ed489"
],
"fields": [
"101e6b19-be80-452e-ab37-b505aee93233",
"78afe6b9-ac8b-44eb-ab97-b4702b0e651f",
"ffff28e1-9911-43e8-b3e5-95213dc47614",
"e1cddd18-d765-4bb9-b1f1-b2fdd6311a91",
"4e195db0-d0fb-4eef-8823-a122a7635f71",
"8e7115b3-1fe9-47cb-8ab0-834af4bb4ab0"
],
"titlefield": "61c995ae-f358-41c9-9486-18415f86d223",
"fieldlists": {
"31cbd8ac-4f13-4ac3-8924-752ea94d1c65": [
"101e6b19-be80-452e-ab37-b505aee93233",
"78afe6b9-ac8b-44eb-ab97-b4702b0e651f",
"ffff28e1-9911-43e8-b3e5-95213dc47614",
"e1cddd18-d765-4bb9-b1f1-b2fdd6311a91",
"4e195db0-d0fb-4eef-8823-a122a7635f71",
"8e7115b3-1fe9-47cb-8ab0-834af4bb4ab0"
],
"350988c6-22ce-4a74-a2b7-1c25b23eea27": [
"101e6b19-be80-452e-ab37-b505aee93233",
"78afe6b9-ac8b-44eb-ab97-b4702b0e651f",
"ffff28e1-9911-43e8-b3e5-95213dc47614",
"e1cddd18-d765-4bb9-b1f1-b2fdd6311a91",
"4e195db0-d0fb-4eef-8823-a122a7635f71",
"8e7115b3-1fe9-47cb-8ab0-834af4bb4ab0"
]
},
"layout": "4d412a1c-1e96-45f4-804c-70b1eea2da20",
"childdefinitions": [],
"metadata": {},
"is_base": false,
"is_new": false,
"is_working_copy": false,
"is_extended": true
}
}
}
}
gid
global identifier
original
for extended definitions, this points to the base definition gid
name
name to be used in code, should be variable-name compatible (letters, numbers, underscores - no dashes, spaces, punctuation)
label
a localized label
classes
a list, in order, of the class gids that are part of the definition
fields
a list, in order, of the field gids that are part of the definition
titlefield
gid of a field that is part of the definition and is used as its representation in a tree or in search results
fieldlists
a dictionary with a list of field gids, in order, per fieldlist key
layout
the layout gid
childdefinitions
a list with definition gids for allowed or preferred definitions for child records - can be used to automatically set them, or for a selection list for the record
metadata
a dictionary of user-definable metadata fields, see metadata
is_base
DOESN'T indicate a base definition - it works as a combination with original
to identify base definitions, extended definitions, and working copies of base definitions.
is_new
indicates a newly created definition that has never been committed.
is_working_copy
indicates a new or modified definition that has not been committed.
is_extended
indicates an extended definition - it has modifications made through a record and further modification should always go through the record/definition api too.