REST: Schema
Overview
GET /V1/webforms/schema/{kind} returns what the API may read and write, in a form a client or an AI assistant can check its requests against. The schemas are derived from the form builder, so they list exactly the settings the builder saves, and they include the field types of installed add-ons.
kind | schema_json holds |
|---|---|
field-types | One entry per field type code: label, category, logic_trigger (whether the type can drive conditional logic), convertible_to (types the field can be turned into) and settings |
form | settings: the form's settings |
fieldset | settings: the settings of a section |
logic | trigger_types (field types a rule can watch) and rule_keys (the keys of a logic rule) |
document | A JSON Schema (draft 2020-12) of the whole form document, the format the document reads return and form creation takes |
notification | The notifications part of the document schema: the JSON Schema of the list of a form's notifications. See Form document schema |
The schemas differ from the builder in one place: the form and document schemas still list appearance_* keys besides appearance_max_width. The
API accepts them and saves nothing, because those looks are store view settings now. Set them with
REST: Appearance.
Every response carries the same envelope:
| Member | Meaning |
|---|---|
kind | The kind asked for |
schema_version | Version of the document format (4.0) |
schema_digest | Digest shared by all kinds; it also appears on REST: Capabilities and on every document. Cache the schemas by this value |
schema_json | The schema, as a JSON string |
Setting descriptors
In field-types, form and fieldset, each setting is described by:
| Key | Values |
|---|---|
type | string, boolean, integer, number, enum or json |
enum | The allowed values, for type: enum |
required | Whether the setting must be present |
translatable | Whether the text can differ per store view |
structured | Whether the value is a structure (options, grid columns, gallery images) rather than a scalar |
class | plain; side_effect for settings whose change reaches outside the form, such as redirect_url, captcha_mode or the allowed upload extensions and sizes; secret for values that may not be set through the API |
authority | Form settings only. draft: the value is changed in a draft and goes live when the draft is published. live: update-form writes the value to the live form at once, and the integration needs forms_edit for it |
write | Form settings only: how the API writes the value. direct: at once. confirm: only with a confirmation token, because the effect reaches beyond the form's page (url_key, success_text, redirect_url, captcha_mode, published submissions, cleanup, Do Not Store Submissions, customer access and registration). script: needs forms_scripts and a token (on_load_script, after_submission_script). none: not writable through the API, refused with 400. See Confirmations |
Authentication
OAuth 1.0a integration credentials, as described on REST API. The operation needs forms_view.
Operations
| Method | Path | Operation | ACL resource |
|---|---|---|---|
| GET | /V1/webforms/schema/{kind} | FormReadInterface_getSchema | MageMe_WebForms::api_v1_forms_view |
Errors
| HTTP | Code | When |
|---|---|---|
| 404 | NOT_FOUND | kind is not one of the six values, message Unknown schema "…". |
| 401 / 403 | See REST API |
Examples
The logic vocabulary:
curl https://yourdomain.com/rest/all/V1/webforms/schema/logic \
-H "Authorization: <signed-header>"
{
"kind": "logic",
"schema_version": "4.0",
"schema_digest": "sha256:b803f2e1467f9831fb3b7b5c66617e54c39f4a8be8405b72026ac722c85e9efb",
"schema_json": "{\"trigger_types\":[\"select\",\"select_radio\",\"select_checkbox\",\"select_contact\",\"gallery\",\"swatches\",\"mailchimp_group_select\",\"mailchimp_group_select_radio\",\"mailchimp_group_select_checkbox\",\"zendesk_group_select\",\"zendesk_priority_select\",\"zendesk_type_select\"],\"rule_keys\":[\"field_code\",\"field_id\",\"logic_condition\",\"action\",\"aggregation\",\"value\",\"target\",\"is_active\"]}"
}
One field type from field-types, decoded and shortened:
{
"email": {
"label": "Email",
"category": "Text",
"logic_trigger": false,
"convertible_to": ["text", "textarea"],
"settings": {
"browser_autocomplete": {"type": "string", "required": false, "translatable": false, "structured": false, "class": "plain"},
"comment_position": {"type": "enum", "required": false, "translatable": false, "structured": false, "class": "plain", "enum": ["", "above"]}
}
}
}
Two form settings from form, decoded:
{
"settings": {
"redirect_url": {"type": "string", "required": false, "translatable": false, "structured": false, "class": "side_effect", "authority": "live"},
"submit_button_text": {"type": "string", "required": false, "translatable": false, "structured": false, "class": "plain", "authority": "draft"}
}
}
An unknown kind:
{"message": "Unknown schema \"forms\".", "parameters": {"code": "NOT_FOUND", "details_schema_version": "1", "details_json": "{}"}}