facebook graph api picture - javascript

How can I retrieve friends picture using graph api.
I have manage to get my friends profile picture using this
https://graph.facebook.com/{user_id}
But, I want to get the photos my friend has posted.
I am able to get this data
"link": "http://www.facebook.com/photo.php?fbid=121312&set=a.23342344855.11344514&type=1",
"name": "~KAALAM moments :)",
"caption": "51 new photos",
"icon": "http://static.ak.fbcdn.net/rsrc.php/v1/yz/r/StEh3RhPvjk.gif",
"actions": [
{
"name": "Comment",
"link": "http://www.facebook.com/1140004514/posts/12234"
},
{
"name": "Like",
"link": "http://www.facebook.com/1140004514/posts/12234"
}
],
"type": "photo",
"object_id": "2554798026153",

To get your friend's pictures you will need
Valid access token with friends_photos
HTTP GET \{friendId}\photos to get photo's the friend is tagged in
or
Valid access token with friends_photos
HTTP GET \{friendId}\albums to get a friend's albums listing, loop thru it to get the photos in each album by \{albumId}\photos
Try it out here: https://developers.facebook.com/tools/explorer

Related

how to get the users/me relation in strapi v4

i'va added a relation my user but when i try to query it i can see it even with the populate deep plug in
when i add a normal field, there is no problem but the relation is impossible to see.
here is the user table in the dashboard :
here is the query i'm doing:
http://localhost:1337/api/users/me?populate=deep
end the response i get :
{
"id": 1,
"username": "testAdmin",
"email": "testadmin#gmail.com",
"provider": "local",
"confirmed": true,
"blocked": false,
"createdAt": "2023-01-27T20:38:35.624Z",
"updatedAt": "2023-01-28T17:07:51.151Z",
"test": "test"
}
i've seen the same issue in a github repo but it's fair old and i've not seen any update
any idea ?

Facebook Graph API friends' names and ids

I know that if I simply try to get a list of my friends, it will only return app friends AKA friends who also have given permissions to Facebook
So, rightfully so, when I do a GET 'me/friends', I only see 5 friends.
However, when I do a GET me/posts/?fields=likes.fields(name), it obviously returns data with a list of friends who have liked my posts:
{
"id": "post1id",
"likes": {
"data": [
{
"name": "name1",
"id": "id1"
},
{
"name": "name2",
"id": "id2"
}....
]
}
It shows all friends, so non-app and app friends.
My question is, if all I want to use is my friends' names and id's from this result, would it be allowed, considering that some of these friends are not app-friends?
If you work the API with the user token, you may receive all likes (including friends who don't use the app, non-friends, friends who use the app, pages) but this is at all no indication for a users friends. Anyways you can utilize ALL data provided by the GraphAPI as long as you don't work around the limitations with something like exploiting the game invite feature.

How to get youtube video description with video id?

I am currently using the Javascript API by youtube to display a video on my web page however now I want to also retrieve the youtube description from the video id? How would I go about doing this?
I only want description and title:
ex:
"kind": "youtube#video",
"etag": etag,
"id": string,
"snippet": {
"publishedAt": datetime,
"channelId": string,
"title": string,
"description": string,
"thumbnails": {
(key): {
"url": string,
"width": unsigned integer,
"height": unsigned integer
}
https://developers.google.com/youtube/v3/docs/videos
If anyone could post a link or either show me an example of code on how I can accomplish this?
The developer documentation you linked to has some excellent code examples -- that'll be the best place to start. Use the "list" reference menu for videos.
If you're saying that you just want the title and description without the other fields, you can use the fields parameter in your request ... something like this:
https://www.googleapis.com/youtube/v3/videos?part=snippet&id={VIDEO_ID}&fields=items/snippet/title,items/snippet/description&key={YOUR_API_KEY}

Facebook Graph API - get page feed + full event info?

Is it possible to, in 1 request, get the feed of a page but with the full event info?
As it is now, if a shared event is posted, you only get back the link to that event, no picture or title:
{
"id": "xxx",
"from": {
"category": "Community",
"name": "xxx",
"id": "xxx"
},
"story": "xxx shared xxx's event.",
"link": "https://www.facebook.com/events/xxx/",
"actions": [
{
"name": "Comment",
"link": "https://www.facebook.com/xxx/posts/xxx"
},
{
"name": "Like",
"link": "https://www.facebook.com/xxx/posts/xxx"
}
],
"privacy": {
"value": ""
},
"type": "link",
"status_type": "shared_story",
"application": {
"name": "Links",
"id": "xxx"
},
"created_time": "2013-06-19T10:05:50+0000",
"updated_time": "2013-06-19T10:05:50+0000",
"likes": {
"data": [
{
"name": "xxx",
"id": "xxx"
}
],
"count": 1
}
}
If I understand correctly, you need to retrieve the events but you want to do it all at once with the feed because you want to retrieve the information on the feed anyway.
Before doing that, you must know that the feed doesn't contain all the events.... Once created, a link to the event is automatically shared on the page feed. It is only a reference, which can then be hidden. The event won't be displayed on the feed anymore even if it still exists.
Requesting two different objects at the same time
So, the feed doesn't have the events information and the events and posts (feed) are stored on 2 different tables. Therefore, you need to get the events independently from the feed:
The feed /PAGE_ID/feed
The events /PAGE_ID/events
And, as you wanted, Graph API allows you to do this in only one request:
/PAGE_ID?fields=feed,events
Additional fields
Note that either feed or events accept the limit and fields parameters. For example, events can be specified by:
events.limit(100).fields(location,name,owner,description,updated_time,venue)
Possible fields are given in the doc.
There is no way to get the "full info" at once. You will have to specify each field in the request. So, don't get the "full info", but just the information you really need.
There is a post from Facebook addressing this scenario using multi-queries and FQL (Facebook Query Language). This will allow you to make multiple FQL calls in one request.
https://developers.facebook.com/docs/technical-guides/fql/#multi

get facebook users data of his reads in washington post or yahoo reader

Is there any way to get the reads of a user in washington post or yahoo reader?
I have checked http://developers.facebook.com/docs/reference/api/ where one gets access to news feed and profile feed, but they dont gives what the user has read in washington post / yahoo reader. Is there any way to get this information using javascript jdk?
What I have tried:
After login in thorugh the login in button. I query
FB.api('/me/washington_posts', function(response) {
var wash_post=JSON.stringify(response);
alert(wash_post);
});
graph.facebook.com/me/317071798339058?access_token=AAAAAAITEghM...
graph.facebook.com/me/...
I tried sevaral combinations of washington_posts, but always got error. I know this was not going to work but tried for some luck There is no documentaion of the same as mentioned here.
I believe its not possible to get it as of now as wpsocialreader is a diiferent fb app. apps.facebook.com/wpsocialreader/… I am only able to get the app info.
graph.facebook.com/267401179951379 :
{ "id": "267401179951379", "name": "Washington Post Social Reader", "link": "facebook.com/wpsocialreader";, "likes": 169544, "category": "App", "is_published": true, "website": "washingtonpost.com/socialreader";, "username": "wpsocialreader", "description": ".........", "about": "News. Better with friends. ", "release_date": "2011", "can_post": true, "talking_about_count": 19977 }
I think it is not possible to collect data from washington post reader app, so I am looking if somebody have already done it.
You can get the entries with the open graph action type news.read from yourself or a friend using the graph API:
graph.facebook.com/me/news.reads or graph.facebook.com/USER_ID/news.reads
Obviously, add in the access token and other graph parameters you need as well. This will return all reads from the applications that publish them. You could then pick out the social reader reads by app id.
Hope this helps.
-matt

Categories

Resources