facebook api: how to get the photos uploaded by a userid - facebook-graph-api

There is facebook user url https://www.facebook.com/adikks
If i am loged in facebook. i can view the posts and images which are public
His userid (from http://findmyfbid.com) = 100000041026824
Now i want to view the pics uploaded by the user which can be viewed by plublic using facebook api. I tried
https://graph.facebook.com/100000041026824/photos?type=uploaded&fields=name,source&limit=50&access_token=XXXXXX
also i tried
https://graph.facebook.com/100000041026824/photos?type=uploaded&access_token=XXXXXX
both gives
{
"data": [
]
}
I tried this even in the graph api explorer:
https://graph.facebook.com/v2.4/100000041026824/photos?type=uploaded
It shows the same
{
"data": [
]
}
In contrary I treid for a page:
the link = "https://www.facebook.com/HailHimalayas",
the id = 381200698651805
Now i want to view the pics uploaded in the page and viewed by public
I tried
https://graph.facebook.com/381200698651805/photos?type=uploaded&fields=name,source&limit=50&access_token=XXXXXX
It gives:
{
"data": [
{
"name": "IN EVERY WALK INTO THE NATURE, ONE RECEIVES FAR MORE THEN HE SEEKS..!!\n\nHail Himalayas - Responsible Eco Tourism",
"source": "https://fbcdn-sphotos-f-a.akamaihd.net/hphotos-ak-xfp1/t31.0-8/s720x720/10987450_723146627790542_4281069196911932678_o.jpg",
"created_time": "2015-07-31T06:00:20+0000",
"id": "723146627790542"
},
{
"source": "https://scontent.xx.fbcdn.net/hphotos-xft1/t31.0-8/s720x720/11731578_722471167858088_6058874620639883829_o.jpg",
"created_time": "2015-07-29T12:08:08+0000",
"id": "722471167858088"
},
{
"source": "https://fbcdn-sphotos-g-a.akamaihd.net/hphotos-ak-xfa1/t31.0-8/q88/s720x720/11741148_722471134524758_420698345443715826_o.jpg",
"created_time": "2015-07-29T12:08:08+0000",
"id": "722471134524758"
},
.
.
.
.
.
Why the user pics are not shown while the page pics are shown using facebook api.

Related

GSuite - Last email activity

I am trying to create a GSuite integration using GSuite Admin SDK that will fetch a list of users and the datetime of their last activity. I am able to fetch last login time, but I can't find a way to find the last email activity for a user that uses POP or IMAP email clients.
The data that I am trying to fetch is available in the admin console:
But is there a way to fetch it using Gsuite Admin SDK?
I found a solution to get the email activities for users, but the examples in the API reference were not so straight-forward, and they were spread out on several pages. I ended up using User Usage Report from the GSuite Reports API (as suggested in a comment on the original question): https://developers.google.com/admin-sdk/reports/v1/guides/manage-usage-users
Sample call:
GET https://www.googleapis.com/admin/reports/v1/usage/users/all/dates/2018-05-21?parameters=classroom:last_interaction_time,accounts:last_login_time,accounts:last_sso_time,gmail:last_access_time,gmail:last_imap_time,gmail:last_interaction_time,gmail:last_pop_time,gmail:last_webmail_time
This way I was able to get not only email activities, but also Classroom last interaction time and GSuite last login time and Last SSO time.
Sample user response:
"entity": {
"type": "USER",
"customerId": "customerId",
"userEmail": "sample#email.com",
"profileId": "profileId"
},
"parameters": [
{
"name": "classroom:last_interaction_time",
"datetimeValue": "1970-01-01T00:00:00.000Z"
},
{
"name": "accounts:last_login_time",
"datetimeValue": "2018-05-18T14:46:11.000Z"
},
{
"name": "accounts:last_sso_time",
"datetimeValue": "1970-01-01T00:00:00.000Z"
},
{
"name": "gmail:last_access_time",
"datetimeValue": "2018-05-18T08:43:15.000Z"
},
{
"name": "gmail:last_imap_time",
"datetimeValue": "1970-01-01T00:00:00.000Z"
},
{
"name": "gmail:last_interaction_time",
"datetimeValue": "2018-04-23T07:08:40.000Z"
},
{
"name": "gmail:last_pop_time",
"datetimeValue": "1970-01-01T00:00:00.000Z"
},
{
"name": "gmail:last_webmail_time",
"datetimeValue": "2018-04-23T07:08:44.000Z"
}
]

How do I find which facebook messenger apps are linked with a facebook page through the facebook graph api?

I have been trying this out in the graph api explorer. Here are the steps I have been following:
Get a user access token with the permissions publish_actions, ads_management, manage_pages, publish_pages, pages_messaging, pages_messaging_phone_number, pages_messaging_subscriptions, pages_show_list, and user_events.
I GET the me/accounts endpoint and get this object:
{
"data": [
{
"access_token": "thisIsWhereTheAccessTokenGoes",
"category": "Shopping & Retail",
"category_list": [
{
"id": "200600219953504",
"name": "Shopping & Retail"
}
],
"name": "Some Page",
"id": "123456789",
"perms": [
"ADMINISTER",
"EDIT_PROFILE",
"CREATE_CONTENT",
"MODERATE_CONTENT",
"CREATE_ADS",
"BASIC_ADMIN"
]
}
],
"paging": {
"cursors": {
"before": "MTk1NDA4MDM2NDYyMDY5MAZDZD",
"after": "MTk1NDA4MDM2NDYyMDY5MAZDZD"
}
}
}
I copy the access token and page id from the above page object and paste it into the graph api explorer in the appropriate places.
I GET the endpoint {page-id}/subscribed_apps
I get this empty array:
{
"data": [
]
}
However if I go to my facebook app dashboard and go to the messenger settings and generate a page access token for the same page that I was getting in the graph api explorer, and then I paste that token into the explorer and get the {page-id}/subscribed_apps endpoint I actually get the app info that I was looking for. Something like this:
{
"data": [
{
"link": "https://www.facebook.com/games/?app_id=555555555555",
"name": "Test Messenger Bot",
"id": "555555555555"
}
]
}
I thought this could be because my app was in testing mode, but I tried to create a bot on chatfuel and linked it to the same facebook page and could not see that app listed under subscribed_apps either. I am thinking there is maybe some kind of permissions issue? I appreciate any help on this.

Facebook graph API obtain a specific users's pictures from that same user

I'm working on an Android application and I'm trying to obtain contact pictures from friends. I'm still testing the graph request on the Facebook Graph API Explorer linkhere I'm going to use afterwards in the code, and I've hit a snag...
After generating an Access Token, and validating it allows me access to the correct fields I'm interested, I'm trying to filter the information I'm obtaining from Facebook.
Using the Facebook Graph API Explorer I'm performing the following request:
< USER_ID>?fields=id,first_name,last_name,location,picture,birthday,photos.limit(3).fields(id,picture,source,from)
I obtain, as expected:
{
"id": "<USER_ID>",
"first_name": "<FIRST>",
"last_name": "<LAST>",
"photos": {
"data": [
{
"id": "<PICTURE1>",
"source": "<PIC1.jpg>",
"from": {
"name": "<OTHER_USER1>",
"id": "<OTHER_USER1_ID>"
},
"created_time": "2013-08-17T11:39:19+0000"
},
{
"id": "<PICTURE2>",
"source": "<PIC2.jpg>",
"from": {
"name": "<OTHER_USER2>",
"id": "<OTHER_USER2_ID>"
},
"created_time": "2013-08-04T14:27:07+0000"
},
{
**"id": "<PICTURE3>"**,
"source": "<PIC3.jpg>",
"from": {
"name": "<USER>",
**"id": "<USER_ID>"**
},
"created_time": "2013-08-03T17:35:20+0000"
}
],
"paging": {
"previous": "<LINK1>",
"next": "<LINK2>"
}
},
"picture": {
"data": {
"url": "<PIC>",
"is_silhouette": false
}
}
}
What I would like is to only obtain the pictures from ... like the third picture or others, is this possible using the graph api?
Thanks for the help.
Marc
PS:
I've tried adding in the end something like &photos.data.from.id=< USER_ID>
but I till get the same data set in response.
I would like to avoid requesting more pictures and filter it programmatically, because You never know how many pictures are associated with a user that where not submitted by that user.
Not possible with the Graph API, but you can use FQL, to query for the photos of the user (not those in which he's tagged in) -
SELECT pid,src FROM photo WHERE owner = me()
Check FQL - Photo to include the required fields in the result.

Graph API only returns page posts

Im using the Graph API to get certain data from my managed pages.
What i need is the likes, checkins and talking_about_count from my pages.
When i add checkins and talking_about_count i get an error that the API doesn't know the fields.
So i removed those and only asked for the likes and id.
What the API returns is a list with the posts from the page and only showing the id, creation date and the likes(if there are any).
I tested with some other fields like about and website, but they give the same error as checkins and talking_about_count, so i can't get basic data from my pages..
The link i use is this:
https://graph.facebook.com/168707433219493/feed?access_token=[Access_Token]&fields=id,likes,checkins,talking_about_count
And the error i get:
{
"error": {
"message": "(#100) Unknown fields: checkins,talking_about_count.",
"type": "OAuthException",
"code": 100
}
}
When i only ask for id and likes i get:
{
"data": [
{
"id": "168707433219493_333476503426186",
"created_time": "2012-11-28T19:38:57+0000"
},
{
"id": "168707433219493_370257573064477",
"created_time": "2012-11-22T08:12:11+0000"
},
{
"id": "168707433219493_423778884356339",
"likes": {
"data": [
{
"name": "Guido van Tricht",
"id": "1117357415"
}
],
"count": 1
},
"created_time": "2012-11-19T22:46:01+0000"
}
],
"paging": {
"previous": "https://graph.facebook.com/168707433219493/feed?fields=id,likes&access_token=[Access_Token]&limit=25&since=1354131537&__previous=1",
"next": "https://graph.facebook.com/168707433219493/feed?fields=id,likes&access_token=[Access_Token]&limit=25&until=1350819853"
}
}
I hope someone knows how to solve my problem, thanks in advance.
talking_about_count should be in the /PAGE_ID, not in the feed.
Why not get this data from:
https://graph.facebook.com/168707433219493?access_token=[Access_Token]

How do I get the photo URL when reading a user's posts and they Like a photo?

I'm reading my user's friend's wall posts with the Graph API "/637674567/posts". One of the data items is that he likes a photo. Is there a way to get a URL for the photo? When I get the information about the item, I get the following (below). I've verified that Darryl allows apps to see his photos and status updates. I've tried getting every permission available for my app. I can't figure it out. Any help? Thanks!
{
"id": "637674567_10151119619094448",
"from": {
"name": "Darryl Green",
"id": "637674567"
},
"story": "Darryl Green likes a photo.",
"story_tags": {
"0": [
{
"id": 637674567,
"name": "Darryl Green",
"offset": 0,
"length": 19,
"type": "user"
}
]
},
"type": "status",
"application": {
"name": "Likes",
"id": "2409997254"
},
"created_time": "2012-08-29T03:29:03+0000",
"updated_time": "2012-08-29T03:29:03+0000",
"comments": {
"count": 0
}
}
Your friend might have enabled apps to access his photos. But there is another level of privacy setting, that is what kind of data can the apps his friend (you) use, be able to access from his feed ?
Chances are, if those settings don't allow for access to his photos when you are trying to access them via your app, you won't be able to do so.
For a more detailed explanation, please check this reply - http://facebook.stackoverflow.com/a/12151338/1628782.