Skip to content

Get runner data

GET
/wp-json/wp2tutor-forms/form/v1/getRunnerData
curl --request GET \
--url 'https://example.com/wp-json/wp2tutor-forms/form/v1/getRunnerData?id=42' \
--header 'X-WP-Nonce: <X-WP-Nonce>'

Returns the payload the runner uses to mount the form: the container HTML id, window global names for translations/locale, and the props object. This is not /i18n/v1/* and not Gravity Forms: form_id is the string wp2lms-form-{id} of a wp2tutor_form CPT post. Query id is required. Capability is the same as update*: edit_post on that post (the route is not public). There is no request token. translations_variable / locale_variable are JS global names (WP2TutorFormTranslations, WP2TutorFormLocale), not the dictionaries themselves. The runner template reads window[translations_variable][props.runner] and window[locale_variable]. The i18n JSON is not included in this response. props is the form snapshot plus runner fields: element (= form_id), language always ru_RU, sectionsToSave — unique repeatSectionId values from the definition. The rest is FormPost::get_props() (id, token, runner, definition, styles, l10n, hooks, trackers, shortcode, hardcoded results/entries/tier, base64 data, open from query open). Cookie + X-WP-Nonce or Application Password.

id
required
integer

ID of the wp2tutor_form CPT post. Not Gravity Forms. PHP casts to int. Missing post is 404 post_not_found; wrong CPT is 400 invalid_post_type.

Example
42

Runner snapshot: form_id, window global names, and props.

Media typeapplication/json
object
form_id

HTML id of the runner container. PHP: 'wp2lms-form-' . FormPost::get_id(). A string, not a Gravity Forms number and not the bare post ID.

string
translations_variable

Window global name for runner translations. Constant FormRunnerAssetsManager::JS_TRANSLATIONS_VAR = WP2TutorFormTranslations. Template: window[translations_variable][props.runner]. The dictionary itself is not in this response.

string
locale_variable

Window global name for the locale pack. Constant JS_LOCALE_VAR = WP2TutorFormLocale. Template: window[locale_variable]. Contents of locales/*.json are not duplicated here.

string
props

initWP2TutorForm payload. PHP: element + FormPost::get_props() + hardcoded language = ru_RU + sectionsToSave from repeatSectionId in the definition.

object
element

Same id as form_id (wp2lms-form-{id}). Where the runner mounts the UI.

string
id

Numeric ID of the wp2tutor_form post (WP_Post->ID).

integer
token

Current snapshot md5 (generate_token) — the same algorithm the client sends on update*.

string
runner

Current UI runner from meta runner; empty meta defaults to autoscroll.

string
Allowed values: autoscroll chat classic
shareUrl

PHP always returns an empty string.

string
definition

Decoded JSON of post_content (not a string). Tripetto shape: name, clusters, nodes, and so on.

object
key
additional properties
any
styles

Decoded meta styles. Empty meta is [].

object
key
additional properties
any
l10n

Decoded meta l10n for this form. Empty meta is [].

object
key
additional properties
any
hooks

Decoded meta hooks. Empty meta is [].

object
key
additional properties
any
trackers

Decoded meta trackers. Empty meta is [].

object
key
additional properties
any
shortcode

Decoded meta shortcode. After create_new: fullPage, width, height, css.

object
key
additional properties
any
results

PHP always true.

boolean
entries

PHP always 1.

integer
tier

PHP always pro.

string
data

Base64 JSON inventory of Tripetto variables (Variables::inventory()): keys user:*, website:*, visitor:*, server:* with description/value. Empty inventory is an empty string.

string
open

$_GET['open'] of the current request, or null. Not a registered REST arg; it appears in props if query open is present.

string
nullable
language

get_runner_data always sets ru_RU (not get_locale() and not a query param).

string
sectionsToSave

Unique non-empty repeatSectionId values from the definition (recursive walk). None — [].

Array<string>
Example
{
"form_id": "wp2lms-form-42",
"translations_variable": "WP2TutorFormTranslations",
"locale_variable": "WP2TutorFormLocale",
"props": {
"element": "wp2lms-form-42",
"id": 42,
"token": "a1b2c3d4e5f60718293a4b5c6d7e8f90",
"runner": "autoscroll",
"shareUrl": "",
"definition": {
"name": "Form",
"language": "ru_RU",
"clusters": []
},
"styles": {
"display": "inline",
"autoFocus": false
},
"l10n": {},
"hooks": [],
"trackers": [],
"shortcode": {
"fullPage": false,
"width": "",
"height": "",
"css": ""
},
"results": true,
"entries": 1,
"tier": "pro",
"data": "eyJ1c2VyOmxvZ2luIjp7ImRlc2NyaXB0aW9uIjoiLi4uIiwidmFsdWUiOiJhZG1pbiJ9fQ==",
"open": null,
"language": "ru_RU",
"sectionsToSave": []
}
}

Invalid_post_type — post is not CPT wp2tutor_form; invalid_id — same check in the id arg; rest_missing_callback_param — query id is missing.

Media typeapplication/json
object
code

WP_Error code for this API (invalid_token, empty_token, invalid_json, invalid_runner, invalid_permissions, post_not_found, and so on).

string
message

Human-readable text from PHP (Invalid token: generated "…", expected "…", Token cannot be empty., Invalid JSON., etc.).

string
data

Usually { status: HTTP code } on WP_Error from these controllers.

object
Examplegenerated
{
"code": "example",
"message": "example",
"data": {}
}

Not authenticated. WordPress REST: rest_not_logged_in / rest_forbidden. Use cookie + X-WP-Nonce or Application Password.

Media typeapplication/json
object
code

WP_Error code for this API (invalid_token, empty_token, invalid_json, invalid_runner, invalid_permissions, post_not_found, and so on).

string
message

Human-readable text from PHP (Invalid token: generated "…", expected "…", Token cannot be empty., Invalid JSON., etc.).

string
data

Usually { status: HTTP code } on WP_Error from these controllers.

object
Examplegenerated
{
"code": "example",
"message": "example",
"data": {}
}

Invalid_permissions — no edit_post capability on the form post. WordPress REST: rest_forbidden / rest_cookie_invalid_nonce.

Media typeapplication/json
object
code

WP_Error code for this API (invalid_token, empty_token, invalid_json, invalid_runner, invalid_permissions, post_not_found, and so on).

string
message

Human-readable text from PHP (Invalid token: generated "…", expected "…", Token cannot be empty., Invalid JSON., etc.).

string
data

Usually { status: HTTP code } on WP_Error from these controllers.

object
Examplegenerated
{
"code": "example",
"message": "example",
"data": {}
}

Post_not_found — no post with that id; entity_not_found — FormPost did not find the post in the service.

Media typeapplication/json
object
code

WP_Error code for this API (invalid_token, empty_token, invalid_json, invalid_runner, invalid_permissions, post_not_found, and so on).

string
message

Human-readable text from PHP (Invalid token: generated "…", expected "…", Token cannot be empty., Invalid JSON., etc.).

string
data

Usually { status: HTTP code } on WP_Error from these controllers.

object
Examplegenerated
{
"code": "example",
"message": "example",
"data": {}
}