I'm working with the Canvas API and Google Apps Script (JS based). There are some examples of using Apps Script from InstructureCon 2016, but many of those were GET requests rather than POST. I also found this thread, but it hasn't resolved my issue.
I'm playing with creating a Page just because it's easy. I've tried several structures based on the suggestions I've found, none of which have worked. Using:
<SPAN class="punctuation token">{</SPAN><BR /> wiki_page<SPAN class="punctuation token">:</SPAN> <SPAN class="punctuation token">{</SPAN><BR /> title<SPAN class="punctuation token">:</SPAN> <SPAN class="string token">"New Page"</SPAN><SPAN class="punctuation token">,</SPAN><BR /> body<SPAN class="punctuation token">:</SPAN><SPAN class="string token">"A new page"</SPAN><BR /> <SPAN class="punctuation token">}</SPAN><BR /><SPAN class="punctuation token">}</SPAN><SPAN class="line-numbers-rows"><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN></SPAN>returns a 500 error. Moving wiki_page to the top level returns a 422 error. I've also tried setting the contentLength property, which also fails. URL encoding, however, works.
Is there a way to post to the API using JSON objects as payloads rather than URL encoding a string? If so, what am I overlooking?