Created
January 19, 2012 19:51
-
-
Save nfriedly/1642161 to your computer and use it in GitHub Desktop.
FB Graph API: ?ids=username,pagename&fields=name,picture looses picture field for page
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// If you ask for a username before a pagename in the ?ids= Graph API, | |
// it looses the picture field for all pages. | |
// A few examples: | |
// http://graph.facebook.com/?ids=nfriedly&fields=picture,name works correctly: | |
{ | |
"nfriedly": { | |
"name": "Nathan Friedly", | |
"id": "215902661", | |
"picture": "http://profile.ak.fbcdn.net/hprofile-ak-snc4/370681_215902661_1538830995_q.jpg" | |
} | |
} | |
// http://graph.facebook.com/?ids=sociablelabs&fields=picture,name also works correctly: | |
{ | |
"sociablelabs": { | |
"picture": "http://profile.ak.fbcdn.net/hprofile-ak-ash2/373684_143334215679877_2005275946_s.jpg", | |
"name": "Sociable Labs", | |
"id": "143334215679877" | |
} | |
} | |
// however, | |
// http://graph.facebook.com/?ids=nfriedly,sociablelabs&fields=picture,name returns | |
{ | |
"nfriedly": { | |
"name": "Nathan Friedly", | |
"id": "215902661", | |
"picture": "http://profile.ak.fbcdn.net/hprofile-ak-snc4/370681_215902661_1538830995_q.jpg" | |
}, | |
"sociablelabs": { | |
"name": "Sociable Labs", | |
"id": "143334215679877" | |
} | |
} | |
// Note the image is missing from the sociablelabs | |
// If you reverse the order and ask for the page first, it works correctly: | |
// http://graph.facebook.com/?ids=sociablelabs,nfriedly&fields=picture,name returns | |
{ | |
"sociablelabs": { | |
"picture": "http://profile.ak.fbcdn.net/hprofile-ak-ash2/373684_143334215679877_2005275946_s.jpg", | |
"name": "Sociable Labs", | |
"id": "143334215679877" | |
}, | |
"nfriedly": { | |
"name": "Nathan Friedly", | |
"id": "215902661", | |
"picture": "http://profile.ak.fbcdn.net/hprofile-ak-snc4/370681_215902661_1538830995_q.jpg" | |
} | |
} | |
// It's the same behavior if you ask by ID: | |
// http://graph.facebook.com/?ids=143334215679877,215902661&fields=picture,name works, but | |
// http://graph.facebook.com/?ids=215902661,143334215679877&fields=picture,name doesn't | |
// If you don't ask for an additional field, the page gets skipped entirely: | |
// http://graph.facebook.com/?ids=nfriedly,sociablelabs&fields=picture returns | |
{ | |
"nfriedly": { | |
"picture": "http://profile.ak.fbcdn.net/hprofile-ak-snc4/370681_215902661_1538830995_q.jpg" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment