Name is required.
Email address is required.
Invalid email address
Answer is required.
Exceeding max length of 5KB

Permission Denied when using Upload API


I'm trying out video uploading using the Platform API, and am getting a 403 error code and this response:
code: "PermissionDenied"
message: "Not authorized to make this call"
status: "error"
title: "Permission Denied"

I followed some of the logic in the Python Kit, and am trying to upload this file via an HTML form and Javascript. I am able to call the video/create API and receive an 'OK' response, including an upload URL, key, and token. This call is being done on the server, in Python.

When I try to POST the file to this URL from the browser, using the received key and token, I get the permission denied error. I am using an HTML form, and constructing the upload URL with parameters before submitting it via Javascript.

My upload request looks like this:<RECEIVED_KEY>&token=<RECEIVED_TOKEN>&file_size=196147338

Are any specific HTTP headers required? Am I missing a parameter, or a setting in my account? I have looked at the Python kit upload example and the request that gets generated, and I can't see anything obvious. I'm not sure what I'm doing wrong with the request, as the API docs are quite sparse on detail.


5 Community Answers


JW Player Support Agent  
-2 rated :

Are you doing /videos/create first and getting a valid response?

Please see for more details.


0 rated :

Yes, I am calling /videos/create first, and getting a valid response.

I tried out the upload API again using a REST Client app in Chrome, and was able to get it to work. It asked for a couple other params that I didn't see documented anywhere, like "file_name" and "file_path", but I got it working. I mimicked the HTTP headers from the form post, and those seem to be OK too.

I am also using multipart/form-data encoding in my HTML form.


0 rated :

To be clear, I got the call working in the REST Client app only, not in my HTML form post. Maybe there the browser (Chrome) is sending the file in a different way - I'm not sure.


0 rated :

I solved the problem: the file input actually has to have its name attribute set to "file":
<input type="file" name="file"/>

Though the sample code in this document does this, it is not explicitly listed as a requirement. It would be good to update the documentation to mention this.

Also, the "file_name" and "file_path" params do not appear to be required, despite my earlier comment. When using the REST client, I was getting error messages returned saying that these were required. Not sure why that is.

Requiring a file MD5 hash to upload the file could also pose a problem for older web browsers that do not support the File API.


JW Player Support Agent  
0 rated :


We are glad you were able to resolve this.


This question has received the maximum number of answers.