live REST endpoint
Render a registered live-content source with validated fields.
Endpoint#
Render a registered live-content source with validated fields, or a Shortcode element's shortcode. Any shortcode other than a registered source needs unfiltered_html (filter cantata_edit_shortcode_can_author) unless the page's stored draft or published copy already has it. A shortcode the site doesn't have returns 400 naming it.
/wp-json/cantata-edit/v1/live
Named regular-expression groups in this registered route are path parameters. Replace them with an actual matching value when constructing a request.
POST#
This operation uses a server permission callback. Browser clients need an authenticated WordPress session and REST nonce. The server checks the relevant caller capability and feature gates.
Permission expression in this release:
'permission_callback' => static fn( $req ) => (int) $req['post_id'] > 0 ? current_user_can( 'edit_post', (int) $req['post_id'] ) : current_user_can( 'edit_pages' ),
Registered argument schema#
{
"shortcode": {
"type": "string",
"required": true
},
"post_id": {
"type": "integer",
"default": 0
},
"scoped_styles": {
"type": "boolean",
"default": false
}
}
WordPress applies these registered field rules before the callback. Feature-specific validation can add further constraints.
Callback input keys#
post_id, scoped_styles, shortcode. This literal-key inventory supplements the registered schema; nested objects and downstream validators can define additional structure.
Implementation#
- cantata_edit_live_normalize
- cantata_edit_scoped_style_capture_begin
- cantata_edit_scoped_style_capture_finish
Client handling#
Use HTTPS on production sites. Treat authentication failures, validation errors, missing records, and stale-revision conflicts as different outcomes. Read the returned WordPress error code and message. Before retrying a timed-out mutation, determine whether the first request succeeded. Prefer the documented higher-level editor or Ability workflow when an endpoint coordinates several metadata owners.