javascript - How do I get multiple album picture urls with one call to Facebook Graph API -


i can pass string "album.id/photos" , list looks below have each photo id in album, doesn't return url each picture (just id). have run single call each picture want fetch url for, or there way have urls returned call below?

{    "data": [{      "created_time": "2011-01-21t20:19:49+0000",      "id": "10150091489547705"    }, {      "created_time": "2010-02-03t03:31:56+0000",      "id": "293935837704"    }, {      "created_time": "2009-01-02t02:46:28+0000",      "id": "56480657704"    }],    "paging": {      "cursors": {        "before": "mtaxntawote0odk1ndc3mduzd",        "after": "nty0oda2ntc3mdqzd"      }    }  }

here call looks in javascript

 (var j = 0; j < albumids.length; j++) {       var request = albumids[j] + "/photos";      fb.api(request, 'get', {        access_token: usertoken      }, function(responses) {        var pictureurl = responses.data.url; // no url returned - photo id               });

there no need run single request every picture id.

add source in fields of api request returns source url of every picture along id.

eg: /{album_id}/photos?fields=source,created_time

returns output like:

{ "data": [     {     "source" : <source_url1>,     "created_time" : <created_time1>,     "id" : <photo_id1>     },    {     "source" : <source_url2>,     "created_time" : <created_time2>,     "id" : <photo_id2>    } ] } 

hope helps :)


Comments

Popular posts from this blog

Delphi XE2 Indy10 udp client-server interchange using SendBuffer-ReceiveBuffer -

Qt ActiveX WMI QAxBase::dynamicCallHelper: ItemIndex(int): No such property in -

Enable autocomplete or intellisense in Atom editor for PHP -