Jason Weed Ling

Handling Pages Externally - Finally a page_id

Blog Post created by Jason Weed Ling on Jan 8, 2018

It’s no secret that externally handling pages was difficult with Canvas. The problem was the API didn’t expose an ID for the page, so you needed to look it up by title.

https://<ORG>.instructure.com/courses/<COURSE ID>/pages/<MY-PAGE-TITLE>

 

Simple enough if you know the title and the users never change it, but that’s just wishful thinking.

 

I’m not sure when this was released, but Mark mentioned it and I couldn’t be happier.  So now the page details include a page_id field you can store if your external system needs to link back to a specific page.

{     
   "title": "My Page Title",    
   "created_at": "2018-01-05T15:54:00Z",    
   "url": "my-page-title",    
   "editing_roles": "teachers",    
   "page_id": 1234,
   
   "last_edited_by": {        
      "id": 4321,        
      "display_name": "Jason",        
      "avatar_image_url": "...",        
      "html_url": "..."    
   }
}

The API call is just as you would expect.

https://<ORG>.instructure.com/api/v1/courses/<COURSE ID>/pages/<PAGE ID>

Or, if you still need to use the page title.

https://<ORG>.instructure.com/api/v1/courses/<COURSE ID>/pages?search_term=<My Page Title>

Thanks Canvas for continuing to make things better!

 

 

 

Originally posted by me at codesequences.com, Canvas LMS Page Handling Improvements – Code Sequences 

Outcomes