Pages
Pages are rich content associated with Courses and Groups in Canvas. The Pages API allows you to create, retrieve, update, and delete pages.
Note on page identifiers
Most Pages API endpoints accept identification of the Page as either a URL or an ID. In ambiguous cases, the URL takes precedence.
For example, if you have a page whose ID is 7 and another whose ID is 8 and whose URL is "7", the endpoint /api/v1/courses/:course_id/pages/7
will refer to the latter (ID 8). To explicitly request by ID, you can use the form /api/v1/courses/:course_id/pages/page_id:7
.
A Page object looks like:
A PageRevision object looks like:
WikiPagesApiController#show_front_page
GET /api/v1/courses/:course_id/front_page
GET /api/v1/courses/:course_id/front_page
Scope: url:GET|/api/v1/courses/:course_id/front_page
GET /api/v1/groups/:group_id/front_page
GET /api/v1/groups/:group_id/front_page
Scope: url:GET|/api/v1/groups/:group_id/front_page
Retrieve the content of the front page
Example Request:
Returns a Page object.
WikiPagesApiController#duplicate
POST /api/v1/courses/:course_id/pages/:url_or_id/duplicate
POST /api/v1/courses/:course_id/pages/:url_or_id/duplicate
Scope: url:POST|/api/v1/courses/:course_id/pages/:url_or_id/duplicate
Duplicate a wiki page
Example Request:
Returns a Page object.
WikiPagesApiController#update_front_page
PUT /api/v1/courses/:course_id/front_page
PUT /api/v1/courses/:course_id/front_page
Scope: url:PUT|/api/v1/courses/:course_id/front_page
PUT /api/v1/groups/:group_id/front_page
PUT /api/v1/groups/:group_id/front_page
Scope: url:PUT|/api/v1/groups/:group_id/front_page
Update the title or contents of the front page
Request Parameters:
Parameter | Type | Description |
---|---|---|
|
| The title for the new page. NOTE: changing a page’s title will change its url. The updated url will be returned in the result. |
|
| The content for the new page. |
|
| Which user roles are allowed to edit this page. Any combination of these roles is allowed (separated by commas).
Allowed values: |
|
| Whether participants should be notified when this page changes. |
|
| Whether the page is published (true) or draft state (false). |
Example Request:
Returns a Page object.
GET /api/v1/courses/:course_id/pages
GET /api/v1/courses/:course_id/pages
Scope: url:GET|/api/v1/courses/:course_id/pages
GET /api/v1/groups/:group_id/pages
GET /api/v1/groups/:group_id/pages
Scope: url:GET|/api/v1/groups/:group_id/pages
A paginated list of the wiki pages associated with a course or group
Request Parameters:
Parameter | Type | Description |
---|---|---|
|
| Sort results by this field. Allowed values: |
|
| The sorting order. Defaults to ‘asc’. Allowed values: |
|
| The partial title of the pages to match and return. |
|
| If true, include only published paqes. If false, exclude published pages. If not present, do not filter on published status. |
|
|
If this is a block_editor page, returns the block_editor_attributes. Allowed values: |
Example Request:
Returns a list of Page objects.
POST /api/v1/courses/:course_id/pages
POST /api/v1/courses/:course_id/pages
Scope: url:POST|/api/v1/courses/:course_id/pages
POST /api/v1/groups/:group_id/pages
POST /api/v1/groups/:group_id/pages
Scope: url:POST|/api/v1/groups/:group_id/pages
Create a new wiki page
Request Parameters:
Parameter | Type | Description |
---|---|---|
| Required | The title for the new page. |
|
| The content for the new page. |
|
| Which user roles are allowed to edit this page. Any combination of these roles is allowed (separated by commas).
Allowed values: |
|
| Whether participants should be notified when this page changes. |
|
| Whether the page is published (true) or draft state (false). |
|
| Set an unhidden page as the front page (if true) |
|
| Schedule a future date/time to publish the page. This will have no effect unless the “Scheduled Page Publication” feature is enabled in the account. If a future date is supplied, the page will be unpublished and wiki_page will be ignored. |
Example Request:
Returns a Page object.
GET /api/v1/courses/:course_id/pages/:url_or_id
GET /api/v1/courses/:course_id/pages/:url_or_id
Scope: url:GET|/api/v1/courses/:course_id/pages/:url_or_id
GET /api/v1/groups/:group_id/pages/:url_or_id
GET /api/v1/groups/:group_id/pages/:url_or_id
Scope: url:GET|/api/v1/groups/:group_id/pages/:url_or_id
Retrieve the content of a wiki page
Example Request:
Returns a Page object.
PUT /api/v1/courses/:course_id/pages/:url_or_id
PUT /api/v1/courses/:course_id/pages/:url_or_id
Scope: url:PUT|/api/v1/courses/:course_id/pages/:url_or_id
PUT /api/v1/groups/:group_id/pages/:url_or_id
PUT /api/v1/groups/:group_id/pages/:url_or_id
Scope: url:PUT|/api/v1/groups/:group_id/pages/:url_or_id
Update the title or contents of a wiki page
NOTE: You cannot specify the ID when creating a page. If you pass a numeric value as the page identifier and that does not represent a page ID that already exists, it will be interpreted as a URL.
Request Parameters:
Parameter | Type | Description |
---|---|---|
|
| The title for the new page. NOTE: changing a page’s title will change its url. The updated url will be returned in the result. |
|
| The content for the new page. |
|
| Which user roles are allowed to edit this page. Any combination of these roles is allowed (separated by commas).
Allowed values: |
|
| Whether participants should be notified when this page changes. |
|
| Whether the page is published (true) or draft state (false). |
|
| Schedule a future date/time to publish the page. This will have no effect unless the “Scheduled Page Publication” feature is enabled in the account. If a future date is set and the page is already published, it will be unpublished. |
|
| Set an unhidden page as the front page (if true) |
Example Request:
Returns a Page object.
WikiPagesApiController#destroy
DELETE /api/v1/courses/:course_id/pages/:url_or_id
DELETE /api/v1/courses/:course_id/pages/:url_or_id
Scope: url:DELETE|/api/v1/courses/:course_id/pages/:url_or_id
DELETE /api/v1/groups/:group_id/pages/:url_or_id
DELETE /api/v1/groups/:group_id/pages/:url_or_id
Scope: url:DELETE|/api/v1/groups/:group_id/pages/:url_or_id
Delete a wiki page
Example Request:
Returns a Page object.
WikiPagesApiController#revisions
GET /api/v1/courses/:course_id/pages/:url_or_id/revisions
GET /api/v1/courses/:course_id/pages/:url_or_id/revisions
Scope: url:GET|/api/v1/courses/:course_id/pages/:url_or_id/revisions
GET /api/v1/groups/:group_id/pages/:url_or_id/revisions
GET /api/v1/groups/:group_id/pages/:url_or_id/revisions
Scope: url:GET|/api/v1/groups/:group_id/pages/:url_or_id/revisions
A paginated list of the revisions of a page. Callers must have update rights on the page in order to see page history.
Example Request:
Returns a list of PageRevision objects.
WikiPagesApiController#show_revision
GET /api/v1/courses/:course_id/pages/:url_or_id/revisions/latest
GET /api/v1/courses/:course_id/pages/:url_or_id/revisions/latest
Scope: url:GET|/api/v1/courses/:course_id/pages/:url_or_id/revisions/latest
GET /api/v1/groups/:group_id/pages/:url_or_id/revisions/latest
GET /api/v1/groups/:group_id/pages/:url_or_id/revisions/latest
Scope: url:GET|/api/v1/groups/:group_id/pages/:url_or_id/revisions/latest
GET /api/v1/courses/:course_id/pages/:url_or_id/revisions/:revision_id
GET /api/v1/courses/:course_id/pages/:url_or_id/revisions/:revision_id
Scope: url:GET|/api/v1/courses/:course_id/pages/:url_or_id/revisions/:revision_id
GET /api/v1/groups/:group_id/pages/:url_or_id/revisions/:revision_id
GET /api/v1/groups/:group_id/pages/:url_or_id/revisions/:revision_id
Scope: url:GET|/api/v1/groups/:group_id/pages/:url_or_id/revisions/:revision_id
Retrieve the metadata and optionally content of a revision of the page. Note that retrieving historic versions of pages requires edit rights.
Request Parameters:
Parameter | Type | Description |
---|---|---|
|
| If set, exclude page content from results |
Example Request:
Returns a PageRevision object.
POST /api/v1/courses/:course_id/pages/:url_or_id/revisions/:revision_id
POST /api/v1/courses/:course_id/pages/:url_or_id/revisions/:revision_id
Scope: url:POST|/api/v1/courses/:course_id/pages/:url_or_id/revisions/:revision_id
POST /api/v1/groups/:group_id/pages/:url_or_id/revisions/:revision_id
POST /api/v1/groups/:group_id/pages/:url_or_id/revisions/:revision_id
Scope: url:POST|/api/v1/groups/:group_id/pages/:url_or_id/revisions/:revision_id
Revert a page to a prior revision.
Request Parameters:
Parameter | Type | Description |
---|---|---|
| Required | The revision to revert to (use the List Revisions API to see available revisions) |
Example Request:
Returns a PageRevision object.
© Instructure, Inc. Generated on Wed Nov 6 14:20:08 2024 This documentation is generated directly from the Canvas LMS source code, available on Github.
Last updated