Skip to content

Stop a running build

POST
/wp-json/wp2lms/static-builder/v1/builds/{id}/stop
curl --request POST \
--url 'https://example.com/wp-json/wp2lms/static-builder/v1/builds/128/stop?blog_id=1' \
--header 'X-WP-Nonce: <X-WP-Nonce>'

Sets status stopping when the current status is pending or building. No request body. PHP does not kill the generator process here: only set_build_status(Stopping) and serialize. Any other status (new, completed, error, stopped, stopping, …) — 409 cannot_stop. This is not DELETE and not run. Requires manage_network or edit_pages. Cookie + X-WP-Nonce or Application Password.

id
required
integer
>= 1

CPT wp2lms_static_build post ID (same number as StaticBuild.id). ≤ 0 — 400 invalid_id.

Example
128
blog_id
integer
>= 1

Multisite site ID to read/write builds on. Optional: PHP uses get_current_blog_id(). ≤ 0 — 400 invalid_blog. Missing or foreign-network site — 404 blog_not_found. Usually omitted on a single site.

Example
1

Stop requested. Body is serialize; status is typically stopping.

Media typeapplication/json
object
id

CPT wp2lms_static_build post ID.

integer
status

BuildStatus->value: new, pending, building, completed, error, stopped, rebuild, build, stopping. After create typically new; after async run — pending.

string
terminal

True for completed, error, stopped.

boolean
config
object
course_name

ACF courseName on the saved build.

string
api_type

ACF apiType; empty values become local.

string
course_id

ACF courseID (get_course_id); may be an empty string.

string
build_course_id

Linked wp2lms_courses CPT ID (meta ssb_course_id). 0 if unlinked.

integer
version

Version number from ACF (get_version_number), default 1.

number
course_comment

ACF courseComment.

string
export_mode

Package or live (get_export_mode; other/empty → package).

string
page_ids

Page IDs in package order; first item is the main page.

Array<integer>
main_page_id

Main page ID (get_main_page), usually page_ids[0].

integer
is_primary

Favourite build for the course (meta ssb_is_primary). At most one per linked course; star in the course Builds metabox.

boolean
use_sections_in_menu

True when at least one selected page has a sections-taxonomy term. The site option cannot be set via this REST body.

boolean
disable_auto_addition_data

Site-wide Static Builder setting disableAutoAdditionData (not a REST body field).

boolean
not_include_media_files_build

For package — site setting notIncludeMediaFilesBuild; for live PHP always returns false.

boolean
save_external_files

For package — saveExternalFiles (null → true); for live always false (off-site files are not downloaded).

boolean
revision

Build revision number from meta (get_revision_number).

integer
logs

Step log (get_logs(true) — newest first). Usually [] right after create.

Array<object>
object
time

Unix timestamp of the build-step log (0 if meta has no time).

integer
level

Build log level (info if meta has no level).

string
message

Package generation step text.

string
view_url

View URL (index.html / live). Non-null only when status=completed and a view file exists; otherwise null (including after create).

string
nullable
zip_url

ZIP URL. Non-null only when completed and the archive exists (typically package/scorm/xapi). For live often null.

string
nullable
files_url

Directory URL {uploads}/wp2lms-static/{id}/. Always a string, even if files are not there yet.

string
edit_url

Raw wp-admin link to the build card (get_edit_post_link(..., 'raw')).

string
nullable
blog_id

Site ID that owns the build (get_current_blog_id after switch_to_blog).

integer
Example
{
"id": 128,
"status": "stopping",
"terminal": false,
"config": {
"course_name": "Information Security Basics",
"api_type": "scorm",
"course_id": "course-infosec-101",
"version": 1,
"course_comment": "Package for the LMS",
"export_mode": "package"
},
"page_ids": [
42,
57
],
"main_page_id": 42,
"use_sections_in_menu": false,
"disable_auto_addition_data": false,
"not_include_media_files_build": false,
"save_external_files": true,
"revision": 1,
"logs": [],
"view_url": null,
"zip_url": null,
"files_url": "https://pulse.example.com/wp-content/uploads/wp2lms-static/128/",
"edit_url": "https://pulse.example.com/wp-admin/post.php?post=128&action=edit",
"blog_id": 1
}

Wp2lms_static_builder_invalid_id — id ≤ 0; invalid_blog — blog_id ≤ 0.

Media typeapplication/json
object
code

Machine-readable WP_Error code (for example wp2lms_static_builder_busy, rest_forbidden, invalid_nonce).

string
message

Human-readable error message from PHP / WordPress REST.

string
data

Usually { status: <HTTP code> }. If status is missing, core REST often returns 500.

object
key
additional properties
any
Example
{
"code": "wp2lms_static_builder_busy",
"message": "Build is currently building and cannot be updated.",
"data": {
"status": 409
}
}

Not authenticated. DualRest: rest_forbidden (status 401) when there is no cookie session. Cookie + X-WP-Nonce or Application Password.

Media typeapplication/json
object
code

Machine-readable WP_Error code (for example wp2lms_static_builder_busy, rest_forbidden, invalid_nonce).

string
message

Human-readable error message from PHP / WordPress REST.

string
data

Usually { status: <HTTP code> }. If status is missing, core REST often returns 500.

object
key
additional properties
any
Example
{
"code": "wp2lms_static_builder_busy",
"message": "Build is currently building and cannot be updated.",
"data": {
"status": 409
}
}

Missing manage_network (multisite) or edit_pages (single site); invalid REST nonce rest_cookie_invalid_nonce.

Media typeapplication/json
object
code

Machine-readable WP_Error code (for example wp2lms_static_builder_busy, rest_forbidden, invalid_nonce).

string
message

Human-readable error message from PHP / WordPress REST.

string
data

Usually { status: <HTTP code> }. If status is missing, core REST often returns 500.

object
key
additional properties
any
Example
{
"code": "wp2lms_static_builder_busy",
"message": "Build is currently building and cannot be updated.",
"data": {
"status": 409
}
}

Wp2lms_static_builder_not_found — no build of this CPT; blog_not_found — site missing or on another network.

Media typeapplication/json
object
code

Machine-readable WP_Error code (for example wp2lms_static_builder_busy, rest_forbidden, invalid_nonce).

string
message

Human-readable error message from PHP / WordPress REST.

string
data

Usually { status: <HTTP code> }. If status is missing, core REST often returns 500.

object
key
additional properties
any
Example
{
"code": "wp2lms_static_builder_busy",
"message": "Build is currently building and cannot be updated.",
"data": {
"status": 409
}
}

Wp2lms_static_builder_cannot_stop — status is neither pending nor building.

Media typeapplication/json
object
code

Machine-readable WP_Error code (for example wp2lms_static_builder_busy, rest_forbidden, invalid_nonce).

string
message

Human-readable error message from PHP / WordPress REST.

string
data

Usually { status: <HTTP code> }. If status is missing, core REST often returns 500.

object
key
additional properties
any
Example
{
"code": "wp2lms_static_builder_busy",
"message": "Build is currently building and cannot be updated.",
"data": {
"status": 409
}
}