Håkan Larsson
Håkan Larsson

Reputation: 1

Set name and description when uploading to Vimeo with PHP

I am new at Vimeo upload, and do some testing with the exemple scripts from PHP API (https://github.com/vimeo/vimeo.php), and it works to uploading video! But I can´t set the [body][name] and [body][description] with the script. I have tried to understand the explanation of "https://developer.vimeo.com/api", but I can´t get it right.

My question is: How do I add name and description to my uploading video with my script? (pure PHP)

Can anyone push me in the right direction?

Upvotes: 0

Views: 1185

Answers (2)

Your must first upload the video and then edit it. (Sending the name and description)

The method is PATCH and the url is https://api.vimeo.com/videos/{videoId}

Here I doit with Javascript, but essentially it's the same

Upvotes: 3

Dashron
Dashron

Reputation: 3998

The documentation for editing a video is here.

The php library has examples for making API calls here. And documentation on the upload system here.

The return value of your upload request will contain the uri in the headers, specifically the location header like this:

$response['headers']['location']

As the editing documentation explains, you will need to make a PATCH request to this url, with the fields name and description.

In php, this looks like the following:

$response = $lib->upload($filename);
$lib->request($response['headers']['location'], array('name' => $name, 'description' => $description), 'PATCH');

Upvotes: 1

Related Questions