Skip to content

Update a build

PATCH
/wp-json/wp2lms/static-builder/v1/builds/{id}
curl --request PATCH \
--url 'https://example.com/wp-json/wp2lms/static-builder/v1/builds/128?blog_id=1' \
--header 'Content-Type: application/json' \
--header 'X-WP-Nonce: <X-WP-Nonce>' \
--data '{ "course_name": "Information Security Basics v2", "version": 2 }'

Updates ACF config, page_ids, build_course_id, and/or is_primary on an existing build (BuildService::update), then serialize. All body fields are optional: omitted keys are left untouched. build_course_id > 0 links the course CPT; 0 clears the link. Link without new page_ids pulls pages from course structure (empty course — 400 empty_course). Explicit page_ids win over structure. is_primary: true marks the course favourite (mutex, meta ssb_is_primary); without a link — 400 primary_requires_course. Same star in the course Builds metabox. This does not start generation. If status is building — 409 wp2lms_static_builder_busy (pending may still be edited). 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
Media typeapplication/json
object
page_ids

New page set (same rules as create). If omitted — pages unchanged (except when updating build_course_id without page_ids — then from course structure). Empty array — 400 invalid_page_ids.

Array<integer>
build_course_id

Course CPT ID (≥1) or 0 to clear the link. If omitted — link unchanged. Missing course — 404. With ≥1 and no page_ids — pages from course structure.

integer
course_name

New ACF courseName. If omitted — name unchanged.

string
api_type

New package type. If omitted — apiType unchanged.

string
Allowed values: local scorm xapi
course_id

New LMS/xAPI id. ACF key from submitted api_type or current build apiType.

string
version

New package version, float ≥ 1.

number
>= 1
course_comment

New ACF courseComment.

string
export_mode

New export mode. If omitted — unchanged.

string
Allowed values: package live
is_primary

True — mark favourite (mutex); false — clear. If omitted — unchanged. Without a course link — 400 primary_requires_course.

boolean
Example
{
"course_name": "Information Security Basics v2",
"version": 2
}

Build updated. Body is serialize after writing ACF and pages.

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": "completed",
"terminal": true,
"config": {
"course_name": "Information Security Basics",
"api_type": "scorm",
"course_id": "course-infosec-101",
"build_course_id": 42,
"version": 1,
"course_comment": "Package for the LMS",
"export_mode": "package"
},
"page_ids": [
42,
57
],
"main_page_id": 42,
"is_primary": false,
"use_sections_in_menu": true,
"disable_auto_addition_data": false,
"not_include_media_files_build": false,
"save_external_files": true,
"revision": 3,
"logs": [
{
"time": 1726221720,
"level": "info",
"message": "Build completed"
}
],
"view_url": "https://pulse.example.com/wp-content/uploads/wp2lms-static/128/index.html",
"zip_url": "https://pulse.example.com/wp-content/uploads/wp2lms-static/128/Site_128_1.3.zip",
"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_api_type / invalid_version / invalid_export_mode / invalid_page_ids / page_not_found (HTTP 400) / invalid_id / invalid_blog.

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_busy — status is building, PATCH is refused.

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_update_failed — exception while writing ACF/pages.

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
}
}