问题
Right now I am using the graph API explorer and I have a company type Facebook account. However, the following command do not return "username"/"name" field. I did set a proper username in the Profile page -> Basic Information -> Name/Username (both)
http://graph.facebook.com/11234545656556 (the number is fake for now)
This is the response that I received:
{"id": "11234545656556",
"link": "http://www.facebook.com/profile.php?id=11234545656556",
"timezone": 0,
"locale": "en_US",
"verified": true,
"updated_time": "2012-05-31T22:32:52+0000",
"type": "user"}
However if I query my own individual account, I received the expected response:
{"id": "11234512345",
"name": "John Doe",
"first_name": "John",
"last_name": "Doe",
"link": "http://www.facebook.com/people/John-Doe/11234512345",
"gender": "male",
"locale": "en_US"}
So what can I do to obtain the username/name for the company accounts?
回答1:
Business accounts don't work properly with the API and they don't have names or usernames. They exist on Facebook specifically for managing pages and apps - they should work with the Pages and Ads APIs just fine, but most other calls in the API will not work (for example, they also don't have gender, friends, posts, etc)
If you're talking about a Page, those are accessed differently - see the Page login documentation for details - https://developers.facebook.com/docs/howtos/login/login-as-page/
Specifically, you authorise an app with the manage_pages
permission and you can make an API call to /me/accounts
to get an access token which you can then use to act on behalf of the page
来源:https://stackoverflow.com/questions/10857138/how-to-obtain-username-name-for-a-company-facebook-account