Degraded AWS performance is currently impacting some Canvas users in the North American region. Check Canvas Status for updates.

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
jburant
Community Member

Error creating new page via API

Jump to solution

I am trying to create a new page in a course via the API.  I have gotten the API to do all sorts of things already, but I don't get why I am getting this 400 Bad Request error:

{"errors":{"title":[{"attribute":"title","type":"Title can't be blank","message":"Title can't be blank"}]}}

when I post the following to https://carrollu.test.instructure.com/api/v1/courses/1/pages :

{
"wiki_page[title]":"New Page via API",
"wiki_page[body]":"This would be the body of the new page",
"wiki_page[editing_roles]":"teachers",
"wiki_page[notify_of_update]":false,
"wiki_page[published]":false,
"wiki_page[front_page]":false
}

I have tried it without the "wiki_page" prefixes and that didn't seem to make any difference.

I feel like I must be missing something obvious.

Tags (1)
1 Solution

Accepted Solutions
aday
Community Participant

I think you need to have wiki_page encapsulate the properties and values

here is an example of the payload from one of our integration tests.

{

"wiki_page":

   {

   "title":"Test Page",

   "editing_roles":"teachers",

   "notify_of_update":false,

   "published":false,

   "front_page":false

   }

}

I hope this helps

View solution in original post

2 Replies
aday
Community Participant

I think you need to have wiki_page encapsulate the properties and values

here is an example of the payload from one of our integration tests.

{

"wiki_page":

   {

   "title":"Test Page",

   "editing_roles":"teachers",

   "notify_of_update":false,

   "published":false,

   "front_page":false

   }

}

I hope this helps

View solution in original post

jburant
Community Member

YES!!!  That was it!  I knew it had to be something simple.... thank you so much!