Skip to main content

create_page

Function create_page 

Source
async fn create_page(
    request_id: RequestId,
    cms_update_json: Json<CmsPageUpdate>,
    course_id: Path<Uuid>,
    pool: Data<PgPool>,
    jwt_key: Data<JwtKey>,
    app_conf: Data<ApplicationConfiguration>,
    user: AuthUser,
) -> ControllerResult<Json<Uuid>>
Expand description

POST /api/v0/cms/migration/new_page/{course_id} - Create a new page from Gutenberg blocks.

Creates a new page in the CMS. Accepts a CmsPageUpdate object; if title or url_path are empty they are derived from the first hero-section or heading block in content. The order number is automatically determined.

ยงExample

Request:

POST /api/v0/cms/migration/new_page/aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa HTTP/1.1
Content-Type: application/json

{
  "content": [
    {
      "clientId": "...",
      "isValid": true,
      "name": "moocfi/hero-section",
      "attributes": {
        "title": "My Page Title"
      },
      "innerBlocks": []
    },
    {
      "clientId": "...",
      "isValid": true,
      "name": "core/paragraph",
      "attributes": {
        "content": "Page content here"
      },
      "innerBlocks": []
    }
  ],
  "exercises": [],
  "exercise_slides": [],
  "exercise_tasks": [],
  "url_path": "",
  "title": "",
  "chapter_id": null,
  "hidden": false
}