Skip to main content

Metadata

Wherever the model cannot foresee everything, objects carry typed key/value metadata — with a single mechanism for every object, the scope as a parameter: same model, same screen, same API.

Fields​

An administrator declares the fields of the workspace in Workspace settings → Metadata:

AttributeValues
scopeworkspace, api, plan, subscription, application
keylowercase, stable — what the API and the exports carry
typestring, text, number, boolean, date, url, email, enum (with options)
requireda missing value is an error
portalsubscription scope: asked in the request form · application scope: filled by the consumer
helpshown under the field
translationsthe label and the help in other languages — {"fr": {"label": …, "help": …}}: the console and the portal show the ones of the reader's language, the label and the help otherwise

The type drives both the rendering and the validation. Values live on each object; keys that are not declared are kept untouched.

curl -X PUT http://localhost:9000/api/workspaces/default/metadata-fields \
-H 'Authorization: Bearer apim-admin-token' -H 'Content-Type: application/json' \
-d '{"fields": [
{"scope": "subscription", "key": "siret", "label": "SIRET number", "type": "string", "required": true, "portal": true,
"translations": {"fr": {"label": "Numéro SIRET", "help": "les 14 chiffres de votre établissement"}}},
{"scope": "plan", "key": "sla", "label": "SLA", "type": "enum", "options": ["none", "99.5", "99.9"], "required": true}
]}'

The PUT replaces the whole set: the field list is a document the administrator edits.

Where they are checked​

  • The request form of every plan: the subscription fields marked portal are asked in the portal's subscribe dialog, validated, stored on the subscription and shown to the reviewer. The other subscription fields are filled by producers from the subscription review.
  • Plans: a required plan field missing on a plan is a draft error — it blocks the publication.
  • APIs, applications, the workspace: checked when they are saved.

Never projected​

Metadata serves display, notifications and the review of requests. It is never written to the gateway, whatever its scope.