Skip to content

Validate Gutenberg HTML files

POST
/wp-json/wp2/local-sync/v1/validate
curl --request POST \
--url https://example.com/wp-json/wp2/local-sync/v1/validate \
--header 'Content-Type: application/json' \
--header 'X-WP-Nonce: <X-WP-Nonce>' \
--data '{ "path": "example", "paths": [ "example" ], "content": "example" }'

Validates Gutenberg HTML (body content, path, or paths) without writing to the database. Block errors return 422; missing input returns 400.

blog_id
integer

Network site ID. Optional on a single site.

Media typeapplication/json
object
path

Relative file path in the Local Sync directory.

string
paths

Several paths for batch validation.

Array<string>
content

Document body (Gutenberg HTML, Studio, validate).

string
Example
{
"path": "example",
"paths": [
"example"
],
"content": "example"
}

Validation result

Media typeapplication/json
object
ok

Whether the operation succeeded.

boolean
blog_id

Network site ID. Optional on a single site.

integer
path

Relative file path in the Local Sync directory.

string
nullable
base_path

Field “base_path” as returned or accepted by PHP.

string
errors

Error list.

Array<object>
object
code

Machine-readable error or event code.

string
message

Message text (log, PIN, or password reset).

string
warnings

Validator warnings.

array
blocks_count

Number of Gutenberg blocks.

integer
results

Per-file validate results.

array
Examplegenerated
{
"ok": true,
"blog_id": 1,
"path": "example",
"base_path": "example",
"errors": [
{
"code": "example",
"message": "example"
}
],
"warnings": [
"example"
],
"blocks_count": 1,
"results": [
"example"
]
}

Wp2lms_local_sync_validate_input

Media typeapplication/json
object
code

Machine-readable error or event code.

string
message

Message text (log, PIN, or password reset).

string
data

Extra WP_Error or license payload.

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

Machine-readable error or event code.

string
message

Message text (log, PIN, or password reset).

string
data

Extra WP_Error or license payload.

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

Insufficient capability or invalid REST nonce. WordPress REST: rest_forbidden / rest_cookie_invalid_nonce.

Media typeapplication/json
object
code

Machine-readable error or event code.

string
message

Message text (log, PIN, or password reset).

string
data

Extra WP_Error or license payload.

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

Wp2lms_local_sync_unknown_blog

Media typeapplication/json
object
code

Machine-readable error or event code.

string
message

Message text (log, PIN, or password reset).

string
data

Extra WP_Error or license payload.

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

Validation failed (ok=false)

Media typeapplication/json
object
code

Machine-readable error or event code.

string
message

Message text (log, PIN, or password reset).

string
data

Extra WP_Error or license payload.

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