Error creating new page via API

Jump to solution
jburant
Community Novice

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.

1 Solution
aday
Community Explorer

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