AnsweredAssumed Answered

Canvas File Upload API POST and Amazon

Question asked by Marc Mestre on Nov 22, 2016
Latest reply on Dec 3, 2016 by Garth Egbert

Hello all,


Running into a bit of a weird roadblock here using the Canvas File Upload API to upload a file to a course via API. I've followed the documentation here: Uploading Files - Canvas LMS REST API Documentation


I think I've followed the directions correctly. I'm seeing the expected response after step 1.



  [upload_url] =>

  [upload_params] => Array



  [Filename] => test.txt

  [key] => account_101010101010101/attachments/10101010101/test.txt

  [acl] => private


  [Signature] => MORECHARACTERS

  [success_action_redirect] =>

  [content-type] => text/plain



  [file_param] => file



I used the [upload_params] array to POST to [upload_url] (and I also added the file=@test.txt) based on the documentation; but instead of getting the expected 301 with a Location parameter and success url, I am getting a 302.


This 302 has 2 Location headers, both if which are urls to the test.txt file, only it doesn't match what I tried to upload, it's just a text file that says @test.txt. Something is not right here.


It seems that my local file, test.txt, which is in the same directory as the script I'm running, is not making it to Amazon...or...something like that? Is it possible my using Vagrant as a dev environment would cause this issue? I'm trying to do this in our test instance of Canvas, is it possible this could be the reason for the strange behavior? Am I just missing something terribly obvious and I've been staring at this too long?