List course pages for builds
const url = 'https://example.com/wp-json/wp2lms/static-builder/v1/pages?blog_id=1';const options = {method: 'GET', headers: {'X-WP-Nonce': '<X-WP-Nonce>'}};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request GET \ --url 'https://example.com/wp-json/wp2lms/static-builder/v1/pages?blog_id=1' \ --header 'X-WP-Nonce: <X-WP-Nonce>'Returns the catalog of post_type=page posts on the selected site that can be passed as page_ids when creating or updating a static build. PHP: PageCatalog::list_pages() — get_posts with statuses publish, draft, private, pending; sorted by menu_order ASC; no pagination (numberposts=-1).
This is not the list of saved builds and does not start generation. An empty pages array is a valid 200 (the site has no pages).
Query blog_id is optional: default get_current_blog_id(). On multisite PHP switches to that blog (switch_to_blog) when it belongs to the current network.
Requires manage_network (multisite) or edit_pages (single site). Cookie + X-WP-Nonce or Application Password.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Query Parameters
Section titled “Query Parameters”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
1Responses
Section titled “Responses”Site page catalog. Body: blog_id (after resolve) and pages with id, title, slug, menu_order, status.
object
Site the catalog was read from (after resolve_blog_id / switch_to_blog).
All matching pages on the site, unpaginated.
object
WordPress page ID (WP_Post->ID, post_type=page). This value goes into the build page_ids.
Page title (get_the_title).
Post slug (post_name).
WP menu order (menu_order); the catalog is sorted by this field ascending.
Page post_status: publish, draft, private, or pending — as returned by get_posts.
Example
{ "blog_id": 1, "pages": [ { "id": 42, "title": "Introduction", "slug": "introduction", "menu_order": 0, "status": "publish" }, { "id": 57, "title": "Module 1", "slug": "module-1", "menu_order": 1, "status": "draft" } ]}Wp2lms_static_builder_invalid_blog — blog_id ≤ 0 after casting to int.
object
Machine-readable WP_Error code (for example wp2lms_static_builder_busy, rest_forbidden, invalid_nonce).
Human-readable error message from PHP / WordPress REST.
Usually { status: <HTTP code> }. If status is missing, core REST often returns 500.
object
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.
object
Machine-readable WP_Error code (for example wp2lms_static_builder_busy, rest_forbidden, invalid_nonce).
Human-readable error message from PHP / WordPress REST.
Usually { status: <HTTP code> }. If status is missing, core REST often returns 500.
object
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.
object
Machine-readable WP_Error code (for example wp2lms_static_builder_busy, rest_forbidden, invalid_nonce).
Human-readable error message from PHP / WordPress REST.
Usually { status: <HTTP code> }. If status is missing, core REST often returns 500.
object
Example
{ "code": "wp2lms_static_builder_busy", "message": "Build is currently building and cannot be updated.", "data": { "status": 409 }}Wp2lms_static_builder_blog_not_found — site does not exist or belongs to another network (get_site; site_id vs current network).
object
Machine-readable WP_Error code (for example wp2lms_static_builder_busy, rest_forbidden, invalid_nonce).
Human-readable error message from PHP / WordPress REST.
Usually { status: <HTTP code> }. If status is missing, core REST often returns 500.
object
Example
{ "code": "wp2lms_static_builder_busy", "message": "Build is currently building and cannot be updated.", "data": { "status": 409 }}