Flickr Collections as API Call

Inoffical Solution

I have just discovered a problem with the API of Flickr. It is offically not possible to gather informations about collections. Collections in Flickr language are folder or container for sets. Its is a very good way to keep your photos organized. I found a good disscusion about that problem that there is no API for the collections documentated. So I tested it and surprize surpize it works, very good.  See more for a small peace of code.

All u need is a small function like this with a REST call method -> flickr.collections.getTree . this call spids out a xml which is interpreded by simple_xml looks like this.

object(SimpleXMLElement)#424 (2) {
  ["@attributes"] => array(5) {
    ["id"] => string(25) "7992094-721xxx479621"
    ["title"] => string(9) "Australia"
    ["description"] => string(0) ""
    ["iconlarge"] => string(75) "http://farm4.static.flickr.com/3632/cols/7215761xxxx9621_2efb07e80e_l.jpg"
    ["iconsmall"] => string(75) "http://farm4.static.flickr.com/3632/cols/72157xxxx479621_2efb07e80e_s.jpg"
  }
  ["set"] => array(2) {
    [0] => object(SimpleXMLElement)#433 (1) {
      ["@attributes"] => array(3) {
        ["id"] => string(0) ""
        ["title"] => string(0) ""
        ["description"] => string(0) ""
      }
    }
    [1] => object(SimpleXMLElement)#434 (1) {
      ["@attributes"] => array(3) {
        ["id"] => string(0) ""
        ["title"] => string(0) ""
        ["description"] => string(0) ""
      }
    }
  }
}

The reason why this API call isn't relased yet can u see in the missing set attribute values. But the good thing is that we have the collection data and I think that is for most of the people all they need. Hope I could help a few people.

created on 2009-05-18 00:40:41

Work in progress, Comments will be available again soon.