AnsweredAssumed Answered

Error Creating Calendar Events through API

Question asked by David Baker on Jun 17, 2016
Latest reply on Jun 22, 2016 by David Baker

We would like to push our academic calendar from our website's iCalendar file into canvas using the API. I've been successful in getting events and deleting events using the API, but I'm running into issues when trying to create new events. I'm using a PowerShell script to automate the process. My request to create an event is formed as follows:

 

Invoke-RestMethod -Uri https://milligan.instructure.com/api/v1/calendar_events.json  -Method POST -H $headers -Body $json

 

My headers are OK since they're the same as I've used for getting and deleting calendar events. It seems there is something wrong with the URL.

 

Here is my JSON object (the $json variable):

 

{

    "calendar_event[start_at]":  "2016-07-19T21:00:00Z",

    "calendar_event[title]":  "Test Event",

    "calendar_event[end_at]":  "2016-07-19T22:00:00Z",

    "calendar_event[context_code]":  "course_348"

}

 

I receive the following error when making this request:

 

{"errors":[{"message":"The specified resource does not exist."}],"error_report_id":492649}

 

Anybody have any success using the API for creating calendar events? If so, how were your requests formatted? I thought I was matching what was in the API documentation but could be missing something. Any ideas what I might have wrong? Thanks for any help.

 

David

Outcomes