AnsweredAssumed Answered

uploading a file to Canvas through API

Question asked by Kris Sz on Nov 6, 2018
Latest reply on Nov 9, 2018 by Kris Sz

I'm trying to perform a post to

POST /api/v1/users/:user_id/files
to upload a profile picture for each student.


I get an exception in the first step as outlined here:

Uploading Files - Canvas LMS REST API Documentation 

exception that I get is:


{"Http Exception occurred when calling Canvas. StatusCode Unauthorized, Url: users/11308/files, Json sent: {\"name\":\"80508_profile_picture.jpg\",\"size\":9361,\"content_type\":\"image/jpeg\"}"}

Method: POST, RequestUri: '<our server address>/api/v1/users/11308/files'


I can do other api calls like get a user, update a users etc. so I know it's not an authentication issue. Why is it giving me an unauthorized error? Currently we show profile pictures in Canvas by supplying a url to an external source. In order to get that to work our servers had to be white listed. Is it the same situation with uploading files? Is there something that needs to be enabled in order for this to work?