Jump to content

Recommended Posts

Hello,

 

This is the first API I am trying to work with and would like to know if you could guide me a little bit please.

 

I am trying to parse a url as it shows here:

 

https://developer.vimeo.com/api/upload/videos

 

As you can see, the format is:

GEThttps://api.vimeo.com/me

And it should return something like:

"upload_quota":{
"space":{
"free":53525865655,
"max":53687091200,
"used":161225545
},
"quota":{
"hd":true,
"sd":true
}
},

I took a random  user  on Vimeo as an example and tried to output the data based  his account data but no luck:

 

<?php


$api_request_url = 'https://api.vimeo.com/user1577007';


curl_setopt($ch, CURLOPT_HTTPHEADER, array('Accept: application/json'));


curl_setopt($ch, CURLOPT_URL, $api_request_url);


curl_setopt($ch, CURLOPT_HEADER, TRUE);


curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, TRUE);


$api_response = curl_exec($ch);


$api_response_info = curl_getinfo($ch);


curl_close($ch);


// Response HTTP Status Code
echo $api_response_info['upload_quota'];

?>

Any idea what am I actually doing wrong please?

 

Thank you.

Edited by learningprobs
Link to comment
https://forums.phpfreaks.com/topic/301967-struggling-with-api-to-parse/
Share on other sites

Try using the playground they have set up here - it looks like your endpoint call is set up incorrectly. There may be something more egregious that I'm missing as I'm not terribly familiar with the Vimeo API, but I'd start at the malformed request.

Thanks for sharing this beautiful tool I was not aware of :-)

it looks like the problem is actually from the id I am inputting, I thought the "page number" was the id of the user profile but when I try to input this number in the field I am getting the same error...

 

This is weird, no idea what they refer as "page" as I have also tried a video page and it says "error 500".

'page' is defined as "The page number to show". 'per_page' is defined as "Number of items to show on each page. Max 50.". There's also an 'offset' key, which according to the documentation you shouldn't supply. The assumption here would be that 'page' and 'per_page' work together for paginated search results; for instance, to show videos 51-101 of user 1577007's playlist, you would call to 'https://api.vimeo.com/users/1577007/feed?page=2&per_page=50'.

 

Of course, when you do that in the playground, you're told that "The user is not allowed to perform that action." Which means there must be more to it - perhaps you need an API key, or perhaps you can't just pull a random stranger's playlist.

 

If you select 'likes' on the same user, though, you do in fact get some data back, so I'm thinking you may need the user's specific permission to grab his or her feed contents, but that same user's likes are public.

 

Regardless, your best bet is to start by reading the documentation and experimenting with the playground API they've set up.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.