Rest API upload images/video

I tryng to upload imagem and video via REST API but i get this Uncaught exception ‘OAuthException2’ with message 'Request failed with code 414, i convert o base64 as bellow.
$file = file_get_contents(‘test_files/_1.jpg’);
$payload = base64_encode($file);

can someone help me?

Those can’t be the lines generating that error. The error thrown is an OAuthException which comes from the authentication.

is in this oauth-php/library/OAuthRequester.php on line 117

I change from get to post

1 Like

Interestingly enough I ran into the same thing yesterday. I will try to change to post and see what happens.

Problem is not GET for me. It was not properly encoding the media path.

EDIT: @silvasilva00 I think I see what you are talking about now. You changed GET to POST in the callService Function. Is that correct?

1 Like

yes i change GET TO POST in callService

Thank you silvasilva00.

I can confirm that I was also can produce the same error message as you and can confirm that changing GET to POST on the callService Function fixes the problem.

@alex, I think this is a bug.

You can call with GET or POST. GET will be limited in length however.

The purpose of the tutorial is to give a flavour of how to access the API so it’s not a bug as such. Just that for the purposes of the tutorial GET worked fine.

If you’re then modifying that for your own purposes then that and other modifications may be necessary

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.