Having trouble with methods for Vimeo's new API to get url of files

443 views Asked by At

I try to get the the data of the field "files" with "quality" with the value "hd". I read about the endpoints and I try to make a request with thee values of this fields.

My problem is I can't obtain the value of the field "files" because is a vector. How is the way to pass this like an endpoint?.

The resource of research is the follow: https://developer.vimeo.com/api/endpoints.

Actually with my code only I can obtein the principal fields but I can't acces to the fileds compound with others.

$client_id = "XXX"; 
$client_secret= "XXX"; 
$access_token = "XXX" ;
$lib = new Vimeo($client_id, $client_secret, $access_token); 
$response = $lib->request("/videos/videoID")
1

There are 1 answers

3
Dashron On

The return value of the request method will always be an associative array. This associative array will contain three values

  • body: An associative array containing the full json response
  • headers: An associative array of response headers
  • status: The HTTP status code (see http://httpstatus.es for a detailed list)

To access the files array specifically, you would use the following code:

$response['body']['files']

This will contain an array of file objects for you to loop through.

foreach ($response['body']['files'] as $file) {
    // use a $file
}

NOTE: Only PRO members have access to video files, and even then only to their own files.