facebook php sdk - Instagram Graph API: Media Thumbnail URL -
i'm using instagram graph api in business account, , works fine. have created wordpress port of facebook sdk, , function retrieves media items looks (part of class, $fb
object authenticated using default_access_token
in class constructor):
public function get_media( $business_account_id = '', $limit = 15 ) { $limit = absint( $limit ); try { $response = $this->fb->get( "/{$business_account_id}?fields=media.limit({$limit}){media_url,caption,thumbnail_url,permalink}" ); return $response->getdecodedbody(); } catch ( \facebook\exceptions\facebookresponseexception $e ) { return $e->getmessage(); } catch ( \facebook\exceptions\facebooksdkexception $e ) { return $e->getmessage(); } }
the fields i'm requesting, can see, are: media_url
, caption
, thumbnail_url
, permalink
. api responds fields except thumbnail_url
:
array(2) { ["media"]=> array(2) { ["data"]=> array(15) { [0]=> array(4) { ["media_url"]=> string(91) "https://scontent.xx.fbcdn.net/..." ["caption"]=> string(356) "[...]" ["permalink"]=> string(40) "https://www.instagram.com/p/.../" ["id"]=> string(17) "..." } ... } ["paging"]=> array(2) { ["cursors"]=> array(2) { ["before"]=> string(123) "..." ["after"]=> string(122) "..." } ["next"]=> string(438) "https://graph.facebook.com/v2.10/..." } } ["id"]=> string(17) "..." }
i same response using graph api explorer, makes me think related app, maybe permissions (currently manage_pages
, instagram_basic
), special setting or bug (i don't think so, in case...).
what i'm missing?
looks thumbnail_url
available videos only. solution process images php resized version of media object , cache them don't have regenerate images on every request.
Comments
Post a Comment