Update package metadata
const url = 'https://example.com/wp-json/wp2lms-pro/embed-packages/v1/packages/42?blog_id=1';const options = { method: 'PATCH', headers: {'X-WP-Nonce': '<X-WP-Nonce>', 'Content-Type': 'application/json'}, body: '{"title":"Interactive lesson (draft)","status":"draft"}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request PATCH \ --url 'https://example.com/wp-json/wp2lms-pro/embed-packages/v1/packages/42?blog_id=1' \ --header 'Content-Type: application/json' \ --header 'X-WP-Nonce: <X-WP-Nonce>' \ --data '{ "title": "Interactive lesson (draft)", "status": "draft" }'Updates only the package post_title and/or post_status (wp_update_post). Files, ZIP, html/files, and launch_path are not ingested here — use POST …/content for content.
Fields are optional: key title → sanitize_text_field into post_title (empty string is allowed). Key status is applied only if sanitize_key yields publish / draft / private; anything else PHP ignores. If nothing applies, update is skipped and the response is still 200 with the current payload.
Not a package — 404 embed_packages_not_found.
Requires manage_network (multisite) or edit_pages. Cookie + X-WP-Nonce or Application Password.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”CPT wp2lms_embed_pkg post ID (the id field in the payload). Not blog_id and not page_id. Unknown id or another post_type — 404 embed_packages_not_found.
Example
42Query Parameters
Section titled “Query Parameters”Network site ID (switch_to_blog). Optional: defaults to the request current blog. Not a package id and not page_id. Minimum 1; on a single site it must match the current site — otherwise 400 embed_packages_invalid_blog. In a network an unknown site or a site from another network is 404 embed_packages_unknown_blog.
Example
1Request Body
Section titled “Request Body”object
New post_title. Optional; the key must be present for PHP to update the field. Empty string is allowed.
New post_status. Optional. Values outside the trio are ignored (the field is not changed).
Example
{ "title": "Interactive lesson (draft)", "status": "draft"}Responses
Section titled “Responses”Metadata updated (or nothing to change). Body is package_payload.
package_payload response — CPT post plus flattened meta fields and the full meta object.
object
CPT wp2lms_embed_pkg post ID. Same number as {id} in GET/PATCH/DELETE/content/materialize-pages paths.
Package post_title. After ingest PHP may replace it with the launch file <title>.
Package post_status. REST accepts publish/draft/private; the response is whatever is stored.
Copy of meta.content_type (web / scorm1.2 / scorm2004 / xapi or empty).
Copy of meta.content_tool (authoring-tool detector or empty string).
Copy of meta.launch_path — relative launch HTML, not a URL.
Absolute launch URL (uploads baseurl + storage_rel + launch_path). Empty when there is no content.
Copy of meta.activity_id.
Copy of meta.storage_rel under uploads.
Copy of meta.is_multipage.
object
Relative HTML path inside the package directory (posix, no leading /). From PackagePagesIndex::scan.
Title from the file <title> tag, or the basename if the tag is missing.
Full post meta array _wp2lms_embed_package (PackageMeta::get). Empty object when the package has not been ingested.
object
Type after ManifestPipeline — web, scorm1.2, scorm2004, or xapi. Empty until content is uploaded.
Version from the manifest (for SCORM often the same as content_type). Empty string for typical web packages.
XAPI activity id. If the parser omitted it — {home}wp2lms-embed-package/{id}.
Relative launch HTML inside storage (from the manifest or fallback index.html).
Title from launch HTML / manifest; PHP may overwrite the package post_title with this value.
Mastery score from imsmanifest (SCORM), otherwise null.
Authoring-tool detector: ispring, articulate_rise, articulate_storyline, articulate_presenter, captivate, elucidat, or an empty string.
Path from uploads basedir, wp2lms-embed-packages/{id}/.
Unix time of the last successful content write (time() in finalize).
True only for content_type=web with no content_tool and ≥2 HTML files in the index.
HTML index (path+title) when the package is multipage; otherwise [].
object
Relative HTML path inside the package directory (posix, no leading /). From PackagePagesIndex::scan.
Title from the file <title> tag, or the basename if the tag is missing.
Example
{ "id": 42, "title": "Interactive lesson (draft)", "status": "draft", "content_type": "web", "content_tool": "", "launch_path": "index.html", "launch_url": "https://lms.example.com/wp-content/uploads/wp2lms-embed-packages/42/index.html", "activity_id": "https://lms.example.com/wp2lms-embed-package/42", "storage_rel": "wp2lms-embed-packages/42/", "is_multipage": false, "pages": [], "meta": { "content_type": "web", "version": "", "activity_id": "https://lms.example.com/wp2lms-embed-package/42", "launch_path": "index.html", "title": "Interactive lesson", "mastery_score": null, "content_tool": "", "storage_rel": "wp2lms-embed-packages/42/", "uploaded_at": 1726252800, "pages": [], "is_multipage": false }}Embed_packages_invalid_blog — blog_id < 1, or on a single site it does not match the current site.
object
WP_Error code (get_error_code()), e.g. embed_packages_not_found.
WP_Error text (get_error_message()).
WP_Error data. Usually { "status": 404 }. Ingest/materialize errors without status are returned by WordPress REST as 500.
object
Example
{ "code": "embed_packages_not_found", "message": "Package not found.", "data": { "status": 404 }}Not authenticated. WordPress REST: rest_forbidden (status 401) when there is no cookie session. Cookie + X-WP-Nonce or Application Password.
object
WP_Error code (get_error_code()), e.g. embed_packages_not_found.
WP_Error text (get_error_message()).
WP_Error data. Usually { "status": 404 }. Ingest/materialize errors without status are returned by WordPress REST as 500.
object
Example
{ "code": "embed_packages_not_found", "message": "Package not found.", "data": { "status": 404 }}Missing manage_network (multisite) or edit_pages (single site), or invalid REST nonce (rest_cookie_invalid_nonce).
object
WP_Error code (get_error_code()), e.g. embed_packages_not_found.
WP_Error text (get_error_message()).
WP_Error data. Usually { "status": 404 }. Ingest/materialize errors without status are returned by WordPress REST as 500.
object
Example
{ "code": "embed_packages_not_found", "message": "Package not found.", "data": { "status": 404 }}Embed_packages_not_found — no package with this id; embed_packages_unknown_blog — unknown blog_id in the network.
object
WP_Error code (get_error_code()), e.g. embed_packages_not_found.
WP_Error text (get_error_message()).
WP_Error data. Usually { "status": 404 }. Ingest/materialize errors without status are returned by WordPress REST as 500.
object
Example
{ "code": "embed_packages_not_found", "message": "Package not found.", "data": { "status": 404 }}WP_Error from wp_update_post with no HTTP status in data. WordPress REST surfaces those as 500.
object
WP_Error code (get_error_code()), e.g. embed_packages_not_found.
WP_Error text (get_error_message()).
WP_Error data. Usually { "status": 404 }. Ingest/materialize errors without status are returned by WordPress REST as 500.
object
Example
{ "code": "embed_packages_not_found", "message": "Package not found.", "data": { "status": 404 }}