cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Community Member

Canvas API POST request for File Upload returns Error Message required Expires Parameter

I'm trying to upload a file to canvas via a POST request as described in the Canvas Api Documentation.

The first Post request is successful, returning a JSON response.  However, the second Post request, in which I use the JSON parameters from the first request, returns a 403 Forbidden error with the following message: "Query-string authentication requires the Signature, Expires and AWSAccessKeyId parameters."

I'm not sure how to fix this error, as "Expires" does not appear as a parameter in the JSON response, nor does it appear in the Canvas API Documentation.  My Post request does include the Signature and AWSAccessKeyId parameters that I get from the JSON response to the first Post request.

Any ideas on how to fix this?

Also, I am using Google's Advanced Rest Client, and have successfully used the API to upload a file to Canvas using a URL.

Thanks for your help!

-marcus 

3 Replies
Highlighted
Community Coach
Community Coach

Hello mlampert@uchicago.edu...

I am sorry to see that you question has been sitting here unanswered in the Canvas Community since March 16th.  #sadpanda‌  While I do not have an answer for you myself, I wanted to check in with you to see if you've come up with any solutions on your end since you first posted this question.  If so, would you mind sharing what you've come up with?  Or, if you are still looking for some help with this question, please let us know that, too.  In order to help get your question some additional exposure, I am going to share your question with the https://community.canvaslms.com/groups/canvas-developers?sr=search&searchId=a289e086-c15a-4e38-aedc-...‌ group here in the Canvas Community.  If you aren't following this group, use the link I've provided, and then click on the "Follow" button at the top right corner of the page.

Looking forward to hearing from you soon, Marcus!

Highlighted
Surveyor

For the second POST request, you need to attach all the parameters returned from the first POST request response.

For instance, here are the responses from my first POST request

{
"upload_url": "https://instructure-uploads.s3.amazonaws.com",
"upload_params": {
"AWSAccessKeyId": "[AWSAccessKeyId]",
"Filename": "[Filename]",
"key": "[key]",
"acl": "private",
"Policy": "[Policy]",
"Signature": "[Signature]",
"success_action_redirect": "[success_action_redirect]",
"content-type": "[content-type]"
},
"file_param": "file"
}

For the second POST request, you need a body like this

232869_Screen Shot 2017-05-07 at 11.04.38 AM.png

You may find more information in this course (Canvas Dev and Friends ).

Highlighted
Community Coach
Community Coach

mlampert@uchicago.edu,

Were you able to find an answer to your question? I am going to go ahead and mark this question as answered because there hasn't been any more activity in a while so I assume that you have the information that you need. If you still have a question about this or if you have information that you would like to share with the community, by all means, please do come back and leave a comment.  Also, if this question has been answered by one of the previous replies, please feel free to mark that answer as correct.

 

Robbie

Top Kudoed Authors
Labels