Skip to content

List course pages for builds

GET
/wp-json/wp2lms/static-builder/v1/pages
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.

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

Site page catalog. Body: blog_id (after resolve) and pages with id, title, slug, menu_order, status.

Media typeapplication/json
object
blog_id

Site the catalog was read from (after resolve_blog_id / switch_to_blog).

integer
pages

All matching pages on the site, unpaginated.

Array<object>
object
id

WordPress page ID (WP_Post->ID, post_type=page). This value goes into the build page_ids.

integer
title

Page title (get_the_title).

string
slug

Post slug (post_name).

string
menu_order

WP menu order (menu_order); the catalog is sorted by this field ascending.

integer
status

Page post_status: publish, draft, private, or pending — as returned by get_posts.

string
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.

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_blog_not_found — site does not exist or belongs to another network (get_site; site_id vs current 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
}
}