How to upload video to Vimeo through their api?

£可爱£侵袭症+ 提交于 2019-12-11 03:47:33

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!