Append update to wiki page body without replacing entire body
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I am trying to add a small bit of content, "MyUpdate", to a page using this example API request:
var settings = {
"async": true,
"crossDomain": true,
"url": "https://XXX.instructure.com/api/v1/courses/XXX/pages/XXX?wiki_page[body]=MyUpdate",
"method": "PUT",
"headers": {
"authorization": "XXX",
"cache-control": "no-cache"
}
}
$.ajax(settings).done(function (response) {
console.log(response);
});
But I don't want to have my update replace the existing wiki page body. I only want to append my update to the existing body content. In pseudocode it would be 'wiki_page[body]+=MyUpdate' if you know what I mean.
I have thought about getting the content from wiki_page[body], appending my update, then putting it back, but this doesn't always work because sometimes the page is a very large page and its content is too long and I get a "URI Too Long" error.
Does anyone know if it's possible to do what I'm trying to do? And can offer any solutions/suggestions?
Thank you!
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Peter --
You'll need to replace the entire page body, appending your new content to the existing content yourself, but it is possible to do even with large pages. You should be sending the page content in a 'data' attribute rather than baking it into the URL -- that way you'll be able to send arbitrarily large amounts of data.
--Colin