Sending PUT call to set notificaton preference in Canvas API and not succeeding

107 Views Asked by At

I am trying to set notification preferences in Canvas (instructure) LMS using CURL. I can get all the preferences so the User and communication channel is fine. I can put some other data but not a new notification preference. Eventually I would like to put a value for the category, but for now just trying to set one notification preference

This command works fine - get the value of the notification preference curl.exe https://myschool.instructure.com/api/v1/users/33/communication_channels/38/notification_preferences/new_announcement -H "Authorization: Bearer token"

RETURNS

{
  "notification_preferences":[
    {
      "frequency":"never",
      "notification":"new_announcement",
      "category":"announcement"
    }
  ]
}

This command works fine (example of a put via curl) curl.exe https://myschool.instructure.com/api/v1/courses/473/front_page -d wiki_page[body]=”something new” -X PUT -H "Authorization: Bearer token"

This command fails - trying to put a new value for the notification preference curl.exe --verbose https://myschool.instructure.com/api/v1/users/33/communication_channels/38/notification_preferences/new_announcement -d notification_preferences[frequency]=”immediately” -X PUT -H "Authorization: Bearer token"

ERROR in HTML:

<p>
There was a problem with your last request. 
You may have tried to perform an action after a long period of inactivity. 
If that&#39;s the case, try going back, reloading the page you were working on, and resubmitting. 
If not, please let us know what you were doing when the error happened.
</p>

ERROR inside the CURL RESPONSE: HTTP/1.1 422 Unprocessable Entity

Any help is appreciated

0

There are 0 best solutions below