Sunday, August 28, 2011

Youtube API Changes (It's for the better trust me)

This weekend I updated the youtube API. Now most methods accept an array of parameters instead of only specifying the start and count. To clarify $start and $count are out, long live array()!

To give you an example of what I am talking about here is how a called to getUserUploads used to look if you were showing 10 videos per page and were on the second page.

$this->youtube->getUserUploads('default', 11, 10);

This is how the call will looks now.

$this->youtube->getUserUploads('default', array('start-index'=>11, 'max-results'=>10));

This gives way more flexibility, we can now use any of the parameters outlined here. Now using things like the alt parameter you could specify your return data as JSON for easier parsing and usage if XML isn't your thing.

Look through that list and see if any query parameters catch your eye but going forward this will be how to add additional parameters to your api calls.

No comments:

Post a Comment