Read the catalogue and change structure, step by step
Read every table, field, view and form an office has from the API, so your client builds itself from the live office, and change structure only through named, checked metadata messages.
The office describes itself over the API, and structure changes only through named, checked metadata messages.
What it is
- Read endpoints under
/api/v1/metadata: the whole catalogue (/all), the list of tables, one table's bundle by name (fields, views with their columns, forms, relationships, status values and the tables that point to it), and each part on its own. - Builder → Monitoring → Discovery lists every read, runs it with your sign-in and copies the call for a script.
- A table's bundle carries an ETag: send it back, and an unchanged table answers 304 with no body.
- Structure changes are metadata messages: create, update and delete of tables, fields, views, forms and choices (MetadataAttributeCreate and the others), plus helpers such as ColumnCreate and MetadataViewClone. Each is a privilege on a role.
- Deletes go through MetadataDelete alone, with a preview that says what would go and what blocks it.
Good to know
- The Builder uses the same messages, so whatever you do by hand can be scripted.
- Platform tables are never dropped; custom tables may be, by an administrator. Nothing structural is ever changed in the database directly.
- To carry structure to another environment, package it as a solution rather than replaying calls.
Before you start
- A Codossier Office office describes itself: every table, field, choice, view and form is metadata you can read over the API, so a client can build its screens and its calls from the office it talks to instead of from a copy that goes stale.
- Structure is changed through the API too, never in the database: each change is a named metadata message, checked, applied and recorded like any other operation. This guide reads the catalogue for the Court Appearance table, then shows the messages that change structure and what they protect.
1See every metadata endpoint: Builder → Monitoring → Discovery
Open Discovery under Monitoring in the Builder. Metadata Discovery lists every read of the catalogue, grouped: Global (the Version, the Full catalogue in one object, the list of Entities), then per table, per view and per form. Each line shows its address.
The page calls them with your own sign-in. From a script, send the same request with a service account's key (Authorization: Bearer).

2Pick a table and run a read
Choose the table under Entity (here Court Appearance) and press Run on Entity bundle (by name). The answer opens on the right with its status, the request it sent and two buttons: curl copies the same call for a terminal, with the key header, and JSON copies the answer.
The bundle is everything about one table in one call: the table, its fields, views (with their columns), forms, relationships, status values and the tables that point to it.

3Read the bundle: GET /api/v1/metadata/entities/by-name/{table}
The same call from a script. entity gives the table: its schema name, labels, record-number prefix (HRG) and kind (category 8 is a custom table). attributes lists every field with its data_type, whether it is_required, and for a lookup the table it points to and what Codossier Office does to this record when that one is deleted (delete_behavior, delete_effective).
The picture shows one field of 25 and folds the views, forms and status values. Reads by id (/entities/{id}/attributes, /views, /forms) and the whole office at once (/api/v1/metadata/all) answer the same shapes.

4Ask again only when it changed: ETag and 304
A table's bundle carries an ETag. Keep it, and send it back as If-None-Match the next time: while the table has not changed, Codossier Office answers 304 Not Modified with no body, and your client keeps what it has.
GET /api/v1/metadata/version answers the version token of the catalogue and when the office last reloaded its catalogue.

5Change structure only through the metadata messages
A table, field, view, form or choice is created and changed only by the metadata messages, never by SQL. Creating a field, for example, is MetadataAttributeCreate (a POST /api/v1/data/attribute), or in one step with every Builder option, ColumnCreate, whose contract is above: a schema_name, a label (name), a data_type, and for a choice its choice_values, as in the example.
Each message checks the change, applies it to the database, reloads the catalogue and records who did it. Each is a privilege of its own on a role, so a developer may be allowed to add views without being allowed to add tables.

6Delete only through MetadataDelete, preview first
Removing a field, view, form, choice or relationship, or a custom table, goes through one message: MetadataDelete, on the record to delete (POST /api/v1/execute/MetadataDelete/{table}/{id}). Its contract marks it destructive and names its preview: send "preview": true first and Codossier Office says what the delete would do, what blocks it and what goes with it, and deletes nothing.
What you may not do: delete metadata directly through the data API (refused), drop a platform table (only custom tables can be dropped, by an administrator), or touch the database behind Codossier Office. Administrators run MetadataDelete.

What next
- Building tables and fields with clicks, the same messages underneath: Add tables and fields.
- Reading and writing the records themselves: Read and write records over the API. Carrying structure to another environment: Carry your changes from test to production.