Trying to update Announcements via google app script

don_bryn
Community Champion

I'm working on a google sheet that will allow me to manage announcement publish dates in bulk.  It should work similarly to  @James  extension Adjust All Assignment Dates on One Page  as well as the spin-off version bulk editor I created a few weeks ago:  Canvas Bulk Date Editor (Google Sheet).  I'm simply altering the work to be able to adjust announcement dates.

I have managed to GET the announcements via the discussion API using only_announcements=1 as the parameter.  I can alter the dates and prepare the return API call to send the new dates back to Canvas, but I can't figure out why they do not get updated in Canvas.

I'm sure it's related to the API, so maybe someone here can point me in the right direction.

Starting with James' original sheet, the payload (parms) looks like this:

{assignment[due_at]=2018-01-09T02:00:00Z}
{quiz[due_at]=2018-01-10T13:00:00Z}

My payloads look like this:

{discussion[delayed_post_at]=2018-01-15T13:00:00Z}
{discussion[delayed_post_at]=2018-01-12T13:00:00Z}

The url looks like this:

https://scf.instructure.com/api/v1/courses/20565/discussion_topics/148628

The next script line is this:

var response = UrlFetchApp.fetch(url, parms);

Which seems to return the original announcement without any changes.

I'm using the original canvasAPI.gs that James created and it works for quizzes and assignments.  From the way I understand URLFetchApp works, it should POST the parameters to the URL in Canvas, right?  

Is there any way to debug what's happening when Canvas receives the https request?

You are welcome to look at the google doc here:

Canvas Announcement Date Editor - Google Sheets