I'm doing like this.
ListConnectionsResponse r = peopleService.people().connections()
.list("people/me")
.setPageSize(500)
// specify fields to be returned
.setRequestMaskIncludeField("person.names,person.emailAddresses")
.execute();
It returns a list of my connections with emails I have added myself. But not the information gathered from Google+ profiles. Is this possible to fetch also? I tried fetching the individual resourceName, but no email there.
Person p = peopleService.people().get("people/XXxxx").execute();
The Google People API actually does fetch the emails from Google+ profiles, but only the public e-mails. So if the e-mail shows up when you view their profile when not signed in, then it should show up in the response.
However, e-mails that are not public but are shared with your account (e-mails you can only see if you are signed in) are NOT visible through the Google People API for privacy reasons.
Related
I have a scenario where I have to read a mail sent out by a X person with a specific subject, which i will be receiving on a daily basis.
Is there any JAVA Gmail APi provided by google to retrieve the recent mail that i have received.
And also is there a way to retrieve the mail for a given date?
Yes there's a Gmail API and it has a Java client library, you can check the Quickstart to get used to it.
Now, for retrieving a list of mails you will need to use the Users.messages: list endpoint ( There's also a Java example on how to use that endpoint). Answering your question about retrieving certain emails, you will need to use the q parameter and set the values there as if you would be searching an email in the gmail search bar. I will leave you an example that you can try using the Try this API:
List emails from certain user and date.
Notice
You will only get the email's IDs, for getting more info about an email, you will have to use the Users.messages: get endpoint.
Does anyone has some experience with this?
I was trying to find some tutorial for basic operations at least, I found only RestFb java docs, which is not very descriptive.
What I need: getting Instagram user by Id, searching of posts / users by search word, getting users posts, managing posts (publish, unpublish),...
From what I got from the API documentation is that Instagram account is bound to a Facebook page and I need a user access token of the user that has some role at that page.
When I want to get a Facebook user I create a DefaultFacebookClient with the access token and call fatchObject, but what should I create when I want Instagram data?
Thanks very much for any answer.
I think you still need to get the Page object with facebookClient.fetchObject and then get the IgUser object with
IgUser igUser = page.getInstagramBusinessAccount();
keeping in mind that the fetchObject will have to list as parameter fields the Instagram fields as well (e.g., instagram_business_account), like for example:
Page page = facebookClient.fetchObject("fb_page_name", Page.class,
Parameter.with("fields", "id, name, username, about, fan_count, engagement, talking_about_count, picture, website, instagram_business_account"));
hope this helps.
I want to read a facebook logged in user feed/stories published by him/her or from friends pages or groups etc visible on their wall.
I was able to accomplish login, reading user posts. But i was not able to figure out how i read the posts/ feed from other users which we normally see from friends or pages or groups when they open facebook proprietary app.
The only workaround i can think of is reading friends list and their posts and showing them on current logged in user posts. Not sure why i get the same result when i use me/feed or me/posts.
Bundle params = new Bundle();
params.putString("fields", "message,created_time,id,full_picture,status_type,source,comments.summary(true),likes.summary(true)");
params.putString("limit", "100");
/* make the API call */
new GraphRequest(AccessToken.getCurrentAccessToken(), "/me/feed", params, HttpMethod.GET,
new GraphRequest.Callback() {
public void onCompleted(GraphResponse response) {
/* handle the result */
System.out.println("Festival Page response::" + String.valueOf(response.getJSONObject()));
try {
JSONObject jObjResponse = new JSONObject(String.valueOf(response.getJSONObject()));
System.out.println(jObjResponse);
}
catch (Exception e) {
e.printStackTrace();
}
}
}
).executeAsync();
}
This is documented on the User object of the Graph api. And, as of the Graph API v2.6, there is basically one main endpoint from which you get posts from a user.
/{user-id}/feed includes all the things that a user might see on their own profile feed; this includes, e.g., shared links, checkins, photos and status updates. This also includes posts made by friends on the user's profile.
The following endpoints return subsets of the above:
/{user-id}/posts returns the posts created by the user (on their own profile or the profile of a friend), and it may include any kind of content such as shared links, checkins, photos and status updates.
/{user-id}/tagged returns the posts created by friends and shared on the users's profile.
By default each returned post only includes the story field with a textual description of the post. But you can use the ?fields=... parameter to request as many Post fields as you want.
You'll need the user_posts permission for any of these to work.
The following endpoints are deprecated:
/{user-id}/statuses returns only status updates posted by the user on their own profile. [removed after Graph API v2.3]
/{user-id}/home returns a stream of all the posts created by the user and their friends, i.e. what you usually find on the “News Feed” of Facebook. [removed after Graph API v2.3]
Im creating an application to login in Google+ and get friends emails.
Im authenticating succesfully and get token back , but when i fetch friends list , the user class of any single friends has emails=null...
here is the code (After already signed in and get authenticator class):
// Generated libraries for Google APIs
using Google.Apis.Authentication.OAuth2;
using Google.Apis.Authentication.OAuth2.DotNetOpenAuth;
using Google.Apis.Services;
using Google.Apis.Util;
using Google.Apis.Plus.v1;
using Google.Apis.Plus.v1.Data;
// For OAuth2
using DotNetOpenAuth.Messaging;
using DotNetOpenAuth.OAuth2;
//....code for authentication skipped ....
//...callback from json (authentication success)
PlusService ps = new PlusService(new BaseClientService.Initializer()
{
Authenticator = authenticator
});
PeopleFeed peopleFeed = ps.People.List("me", PeopleResource.CollectionEnum.Visible).Fetch();
//After that when i inspect peopleFeed[0].Emails <--- this is null..
any help?
The Google+ API only returns public information. So even if you are permitted to see a person's email address, it does not necessarily mean that the information is public and that it will be returned.
Furthermore, the documentation at https://developers.google.com/+/api/latest/people/list only guarantees that the list of people returned will contain the person's
id
displayName
image
url
and that to get other information about the person, you will need to do a people.get against that ID. But, again, note that you may still not get their email if that information isn't public.
You could also use the Contacts v3 API to get friend's email addresses. You can cross map this to Google+ contacts by looking at the gContact:website element for the contact that comes back in the XML response:
<gContact:website href='http://www.google.com/profiles/1234567890' rel='profile'/>
In that element's href attribute, 1234567890 is the person identifier that would match the id field of the relevant person resource from people.list of the Google+ API.
Note that the profile link is not guaranteed to come back for a contact entry. This occurs when the contact has not been linked to a Google+ profile.
My first guess would be that it's a rights management issue. I remember when I asked for my Google API key, I had to mention what information I want to get.
Could you check your API key settings in the Google Developer network and see if you need to enable it there?
I have got accesstoken using oauth2.0. I am able to get the person name, gender, etc but I am not able to get the email address of the user.
Could any one please paste some sample code or any suggestions on how to get the email address from the google plus API?
You can retrieve a user's email address if they specifically authorize your application to see their email address.
Set your scopes to:
https://www.googleapis.com/auth/plus.login
https://www.googleapis.com/auth/userinfo.email
The JavaScript calls look like this:
gapi.client.load('oauth2', 'v2', function() {
gapi.client.oauth2.userinfo.get().execute(function(resp) {
// Shows user email
console.log(resp.email);
})
});
gapi.client.load('plus', 'v1', function() {
gapi.client.plus.people.get( {'userId' : 'me'} ).execute(function(resp) {
// Shows other profile information
console.log(resp);
})
});
More information https://developers.google.com/+.
Note that you do not need scopes for plus.me or userinfo.profile.
Exposing E-mail addresses of people who have not set it to be visible to 'Public' would obviously be a privacy issue, so that's not possible.
Exposing E-mail addresses of people who have set their E-mail address visibility to 'Public' is possible, but not yet there. It is currently an open issue
Edit: The issue is resolved now, so you can follow the steps in the other answer to get it.