On the playground I get 100 results for https://api.vimeo.com/me/videos
. In my app, running the same GET
request, I get an empty result.
I'm authenticating using Authorization: Bearer <PRIVATE ACCESS TOKEN>
in the header.
public static function headers($post = false)
{
$headers = array
(
'Authorization: Bearer '.self::myToken(),
'Accept: application/json',
'Cache-Control: no-cache',
);
if($post) $headers[] = 'Content-Type: application/json';
return $headers;
}
public static function get($url = '')
{
$curl = curl_init();
curl_setopt($curl, CURLOPT_HEADER, false);
curl_setopt($curl, CURLOPT_HTTPHEADER, self::headers());
curl_setopt($curl, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1);
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($curl, CURLOPT_TIMEOUT, 30);
curl_setopt($curl, CURLOPT_MAXREDIRS, 10);
curl_setopt($curl, CURLOPT_ENCODING, "");
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "GET");
$result = curl_exec($curl);
$curl_info = curl_getinfo($curl);
$error = curl_errno($curl);
curl_close($curl);
return $error
? array('status'=>'error','message'=>$error)
: array('status'=>'success','result'=>json_decode($result,true));
}
print_r(self::get('https://api.vimeo.com/me/videos'));
If I don't include the auth token, I do get a result with an error about not having credentials. But when including the auth token, I get an empty response.
Again, in the API Playground, I get 100 videos in the result. What am I missing here? (The auth token is correct.)
All my videos are private, and the access token I'm using (the only one I've generated for my app) has full permissions, including private.