google+ api person's friends
I am trying 开发者_运维知识库to make a website based on google+ api. I just started looking into the api and it seems they dont have a method to extract a person's circles and friends as facebook does. The api is actually pretty minimal and I wanted to make sure I didnt miss anything. So has anyone used the google+ api and extracted friends information from a user's profile.
There is an undocumented API. Google+ makes these calls to render Google+ pages:
in X’s circles:
https://plus.google.com/u/0/_/socialgraph/lookup/visible/?o=%5Bnull%2Cnull%2C%22GOOGLEPLUSUSERID%22%5D&rt=j
in whose circles?
https://plus.google.com/u/0/_/socialgraph/lookup/incoming/?o=%5Bnull%2Cnull%2C%22GOOGLEPLUSUSERID%22%5D&n=1000&rt=j
via Fragment: Looking up Who’s in Whose Google+ Circles…
Peeking at the Google+ source code reveals a whole bunch of other URL's:
var cRa = new UD("/_/socialgraph/lookup/circles/", ND, "Error loading circles"),
dRa = new UD("/_/socialgraph/lookup/circles_changes/", ND, "Error loading circles changes");
new UD("/_/socialgraph/lookup/external_sites/", WQa, "Error loading external sites");
var eRa = new UD("/_/socialgraph/lookup/visible/", ND, "Error loading people in common"),
fRa = new UD("/_/socialgraph/lookup/incoming/", ND, "Error loading people that have the user in public circles"),
gRa = new UD("/_/socialgraph/lookup/followers/", ND, 'Error loading "People who\'ve added you"'),
hRa = new UD("/_/socialgraph/lookup/ignored/", ND, "Error loading people you've ignored");
new UD("/_/socialgraph/lookup/followingcircles/", XQa, "Error loading your circles");
var iRa = new UD("/_/socialgraph/mutate/modifyfollowingcircles/", SD, "Error modifying your circles"),
jRa = new UD("/_/socialgraph/lookup/people/", ND, "Failed lookup");
new UD("/_/socialgraph/lookup/follower/", VQa, "Error loading whether a person has added you");
var kRa = new UD("/_/socialgraph/lookup/settings/", QD, "Error loading settings"),
lRa = new UD("/_/socialgraph/mutate/settings/", bRa, "Error storing settings"),
mRa = new UD("/_/socialgraph/lookup/find_more_people/", ID, 'Error loading "Find people"'),
nRa = new UD("/_/socialgraph/lookup/close_friend_suggestions/", ID, "Error loading close friend suggestions"),
oRa = new UD("/_/socialgraph/lookup/check_imports/", PQa, "Error loading newly imported people"),
pRa = new UD("/_/socialgraph/get/circlenamesuggestions/", JD, "Error fetching suggested circle names");
new UD("/_/socialgraph/get/num_invites_remaining/", TQa, "Failed to get number of invites remaining");
var qRa = new UD("/_/socialgraph/get/invite_token/", SQa, "Failed to get invite token"),
rRa = new UD("/_/socialgraph/get/inviters/", RQa, ""),
sRa = new UD("/_/socialgraph/mutate/create/", QQa, "Error creating circle"),
tRa = new UD("/_/socialgraph/mutate/modifymemberships/", HD, "Error changing circle memberships."),
uRa = new UD("/_/socialgraph/mutate/removemember/", TD, "Error removing members from circle"),
vRa = new UD("/_/socialgraph/mutate/revert/", aRa, "Error occured while trying to undo your last action"),
wRa = new UD("/_/socialgraph/mutate/properties/", RD, "Error changing circle properties"),
xRa = new UD("/_/socialgraph/mutate/sortorder/", YQa, "Error reordering circles"),
yRa = new UD("/_/socialgraph/mutate/delete/", KD, "Error deleting circle"),
zRa = new UD("/_/socialgraph/mutate/deletemem/", LD, "Error deleting people"),
ARa = new UD("/_/socialgraph/mutate/block_user/", GD, "Error blocking user"),
BRa = new UD("/_/socialgraph/mutate/block_user/", GD, "Error unblocking user"),
CRa = new UD("/_/socialgraph/mutate/block_user/", GD, "Error reporting and blocking user"),
DRa = new UD("/_/socialgraph/mutate/removefromcontacts/", ZQa, "Error removing people from contacts");
new UD("/_/socialgraph/lookup/circlepicker/", MD, "Error loading circles data");
var ERa = new UD("/_/socialgraph/lookup/hovercards/", PD, "Error loading hovercard data"),
FRa = new UD("/_/socialgraph/lookup/peopleincommon/", ND, "Error loading people in common"),
GRa = new UD("/_/socialgraph/notification/invite/", UQa, "Error inviting members"),
HRa = new UD("/_/socialgraph/mutate/block_user/", GD, "Error ignoring members"),
IRa = new UD("/_/socialgraph/mutate/block_user/", GD, "Error unignoring members");
Currently, the Google+ API is an early developer preview. The only thing you can do is access public information read-only. However, there is an official Issue tracker for bugs and feature requests regarding the Google Plus platform.
To be more specific, there's also an open issue for the feature you want to have (access circles and friends). Make sure to "star" this issue in order to get notified when the methods are finally available. Furthermore, the more people star the issue, the more likely it is to be released soon (apparently the Googlers browse this list to determine which feature is requested a lot and which not).
Edit: As Nicholas points out, it is now indeed possible to retrieve a list of friends using people/list, provided you're using the new auth.login
OAuth scope, which will give you access to all people that the user has chosen to share with your application.
I have used Google+ API and they are not offering anything related to friends.
Looks like it's now available! Here is the documentation: https://developers.google.com/+/api/latest/people/get
Request
GET https://www.googleapis.com/plus/v1/people/**userId**/people/**collection**
userId - String - User ID who to fetch.
collection - String - The collection of people to list.
Response
If successful, this method returns a response body with the following structure:
{
"kind": "plus#peopleFeed",
"etag": etag,
"selfLink": string,
"title": string,
"nextPageToken": string,
"totalItems": integer,
"items": [
people Resource
]
}
Requires Scope - https://www.googleapis.com/auth/plus.login
精彩评论