问题
Let's imagine that I have a video url on my site: it's like this: http://example.com/videos/myvideo.mp4 . I want to use Automatic (“pull”) uploads method to upload this video to vimeo. Then I simply want to host it on my site. The problem is that the documentation that they provide is kinda confusing to me (and possibly all other developers getting started with their api). So, from your experience can you tell me how to upload this video to that vimeo and get back the video url that has been uploaded?
I created the vimeo app as they said and I have requested the upload access. It says:
Upload Access
Approved for the following accounts:
Your account
So basically everything is setup. I just need to know what http request should I send to the vimeo server in order to upload that mp4 file that is accessible on the web.
回答1:
The HTTP request is detailed in the pull upload section of the documentation: https://developer.vimeo.com/api/upload/videos#automatic-pull-uploads
An HTTP POST request to https://api.vimeo.com/me/videos with two required, and one optional parameter sent through the request body.
The official PHP library: https://github.com/vimeo/vimeo.php will help you make the upload request, and documentation on making requests using this library is located here: https://github.com/vimeo/vimeo.php#make-requests
Once you have all the pieces together, the request looks kind of like this:
$response = $lib->request('/me/videos', ['type'=>'pull','link'=>$url], 'POST');
来源:https://stackoverflow.com/questions/31640395/how-to-upload-video-to-vimeo-through-their-api