Inconsistent Graph API Behavior for Album Requests - facebook

I am trying to get a listing of photo albums using:
https://graph.facebook.com/USER_ID/albums
It is working perfectly for some users, and other users I am getting nothing:
{
"data": [
]
}
I am sure in both cases the user ID is correct and valid. For the users that return nothing I can see the albums when logged in as the same user, so I don't see how permissions could be an issue.
Any suggestions would be greatly appreciated!

Igy appears to be correct. This is a duplicate of 10939051.
Since I could not find it, the setting that will exclude all user photos and albums from apps can be found by going to Privacy Settings > Apps, Games and Websites > How people bring your info to the apps they use > De-check My photos.
Here is a screen shot:

You'll get better results by writing it this way:
https://graph.facebook.com/USER_ID?fields=albums.fields(id)
I got this result while playing with the Graph API Explorer.
Here,
you've to generate a new token with user_photos and friends_photos selected.
Then, select what you need in the list:
And it seems to display what you need (at least if the ID you are looking for is the one of your friends)!

Related

How to find my own facebook ID? (not the app-scoped ID)

I used to be able to go to my Facebook profile page https://www.facebook.com/{Username} and replace the "www" for "graph" https://graph.facebook.com/{Username}.
The answer to that used to be my real facebook ID and some other info, but now I get:
{
"error": {
"message": "(#803) Cannot query users by their username ({Username})",
"type": "OAuthException",
"code": 803
}
}
Yesterday I made the exact same thing and it worked, but today it doesn't. Is there any other way of finding my ID? Does it work for anyone?
For finding any facebook group_id or page_id or user_id go to inspect element of page and find these in meta tags.
Group Id
fb://group/Here_is_your_group_id
Profile user_id
fb://profile/here_is_your_user_id
Page Id
fb://page/here_is_your_page_id
graph.facebook.com/{Username} is not available now but lookup-id.com still can find your facebook ID
There are already 3 exact same questions in the last 2 hours. Please use the search function of StackOverflow before posting a question!
You cannot get the username field anymore. This is very well documented in the Facebook docs.
See
graph.facebook.com/username does not work
If you only have your user ID, the simplest way would be to use an online service (like this one: http://getuserid.com) and paste your Facebook username.
If you need the user ID by programming, this is different. You could in this case parse the HTML code of the page (CTRL + U will show you the HTML code of the page) and search for the term entity_id, which is the user ID. You could then use regex to extract the information.
There is no way to get your Facebook ID via the Graph API!
You can use a regular expression to find your Facebook ID. If you paste the source of a profile page (or page/group) inside http://regexr.com/3gi7q it will match the Facebook ID for you.
It is using the following regex to find the Facebook ID:
/fb:\/\/profile\/(\d+)|fb:\/\/page\/\?id=(\d+)|fb:\/\/group\/\?id=(\d+)/;
You can also use the tool i created and just fill in your profile url: https://commentpicker.com/find-facebook-id.php
Go to your Facebook profile and right click on your cover photo, if you copy the URL it should have your Facebook id in it like so. fbid is what you want. I don't there's any AIP for it anymore. Looks like Facebook may be finally phasing it out.
https://www.facebook.com/photo.php?fbid=1512641059003115&set=a.1376251679308721.1073741827.100007717054203&type=1
You can use the sources already identified or you can right click below the navigation bar and view page source. Use your CTRL+F (find) and search for [profile_owner&quot].
The number listed shortly thereafter will be your global ID. It will generally look like this:
[profile_owner":"10000320024513431&quot].
The # is listed multiple times (like 75) in the data and follows terms such as ["profile_id"], ["uid":], and [?profileid=] to name a few.
I always us this tool https://www.graphsearcher.com/ to find my personal facebook ID. Hope can help you.
Head over to here and authenticate with it, you can then use the Graph explorer to get your ID. You'll also need an access token to view the https://graph.facebook.com/{ID} page.
I just tested this for you and it works correct.
I can see FB source and above i can see my FB ID also.
I used https://graph.facebook.com/username and tested with firefox.
Maybe your using it wrong per accident?
It seems like code 803 means no valid username.
Are you really sure you are using a correct username?
You can also try below link to find your FB ID.
http://findmyfacebookid.com/
Good luck mate!

Facebook API to get "watched" movies/TV show list or "read" book list?

My facebook profile recently has been migrated to the new layout. In the about page, I found that movies/TV shows sections have been divided into 3 tabs "Watched", "Want to Watch", "Likes". Similar case applies to Books section.
I know that we can use "/me/movies" to get list of movies users liked. However, I can't find the way to get the list of "Watched" and "Want to Watch", which I found interesting to get.
Any suggestion about how I can access (read/write) to these lists in addition to already available "Likes" list for movies/TV show/books? Thanks a lot!
video.watches
Returns no data as of April 4, 2018.
https://developers.facebook.com/docs/reference/opengraph/action-type/video.watches/
If you use Graph API Explorer and point to:
https://graph.facebook.com/me/video.watches
that will give you a list of videos watched.
If it does not, be sure that you have granted the user_actions.video permission by clicking the Get Access Token button, and then checking the user_actions.video box under User Data Permissions, and get a new access token.
My concern is also that there's seemingly no way to actually post to these collections programmatically via Graph. You can post a movie watched from your own app using the video_watches action, but it won't add it to the "Movies I've Watched" collection that the "Movies" application controls (an application seemingly only Facebook itself can post or update through). There's no way to get an access token to post AS the Movies application that I can see. Therefore, there's no way through Graph to post a "movie I've watched" or "movie I want to watch". It will just end up being sandboxed in your own application's collection.
If this is incorrect, please someone chime in on how this might be accomplished.
In my case, I input me/video.watches instead of me?fields=video_watches.
Read this article for more information.

Facebook Graph API returns partial results for albums

When pulling photos from a Facebook album via the graph API, i.e.
https://graph.facebook.com/<albumid>/photos?access_token=<token>&limit=999&fields=name,source
For some albums, it only supplies partial results. For instance, an album with 15 photos may only return 13 photos. This call:
https://graph.facebook.com/<albumid>?access_token=<token>&fields=count
...Indeed returns the proper count of 15. My first thought was that perhaps these 2 "missing" photos have more limiting privacy settings, but every photo in the entire album (which is owned by the owner of the token, incidentally) has the same "visible to friends" privacy setting. Most albums do return all photos, as expected.
Any ideas as to what might be causing this behavior?
I was missing 4 photos of 33 for one of my albums. I added 'user_status' to the permissions and it suddenly works.
Instead of the cause of why it happens, I am suggesting you a workaround. Graph api is well known for returning partial results. (You can search for that, and you get hell lot of such issues.)
why not go the FQL way?
Checkout :https://developers.facebook.com/docs/reference/fql/photo/
You can get the id, or direct images links of the pictures in an album in a single query.
Sample : SELECT src_big FROM photo WHERE aid="20531316728_324257"
This returns the url of biggest version of the pictures inside the album.
This should probably solve your problem as long as you are using a user access_token and not app access_token.

How to get user location with Facebook Graph API

I am trying this in the graph explorer with my account: https://developers.facebook.com/tools/explorer/?method=GET&path=me
I added to the token all the possibly related permissions.
It shows me many info but any location. On my Facebook profile I don't have a hometown but I have the current location, and my friends can see it too. It says I live in *. I couldn't find any privacy settings where I could have set not to show it to any app.
Thanks!
It was a bit tricky, till I found that hometown and location are stored as single-dimensional array in response data. Try the code below:
FB.api('/me', function(response) {
console.log(response.hometown.name);
console.log(response.location.name);
});
This should work.
User location seems to be missing in the https://graph.facebook.com/me since a while. Not sure is there anyway around it to get the location. So, I hope that clears up. FB is weird.
Make sure on the permission and you can check location with this.
https://developers.facebook.com/tools/explorer/?method=GET&path=me%3Flocation

Where is the Facebook Status feed URL these days?

I know that it was previously possible to display your most recent Facebook statuses on your website as an RSS feed, but it seems they've changed their setup and I can't figure out where to find the feed anymore....
I saw some people searching for this a while ago, but since Facebook just released their new layout, I didn't know if this might have changed again.
Any help would be greatly appreciated.
Try this for a feed in JSON-format.
http://graph.facebook.com/[uid]/feed
Facebook appears to have killed all the public status feeds in the name of user privacy. The only way to fetch it is to build a facebook application that gets your status updates, and then associating your facebook account with that application to give it permission to access your status updates so it can put them somewhere else.
Thankfully, someone has already done that for us. Just go to http://apps.facebook.com/statusexport/ while logged in to facebook and grant the app permission. Then it will give you a public URL to an RSS feed of your status updates.
Just keep it simple... This is an easy way to load your latest status(es) using graph.facebook.com through curl / php. Includes a quick simple function.
Easiest way to load your latest facebook status
I found this site which you authenticate, and it will then give you a working rss feed.
I have found that it does have some limitations, but you can see it here:
http://www.fbrss.com
If you wan't to display status updates only, you can use:
https://graph.facebook.com/[uid]/posts
This URL will return a JSON string of user [uid]:s status updates.
To get your status feed, follow these instructions:
Log into Facebook
Go to http://www.facebook.com/notifications.php
Click the link titled "Your Notifications" at the bottom of the box to the right of the list of notifications
That will bring you to a feed of your notifications, which is not what you asked for. This url will be something like feed://www.facebook.com/feeds/notifications.php?id=XXXXXX&viewer= XXXXXX&key=YYYYYYYY&format=rss20
Change notifications.php to status.php in the URL (preserving all the URL parameters).
That should be a feed of your status updates.
Start at http://www.facebook.com/notes.php and click on the "My Friend's Notes" link. Change the friends_notes part of the url to friends_status, and you should be good to go.
Programmatically specifying user to query status updates for
(Note: This is a server-side solution)
It's possible the feed you're looking for has been deprecated for security purposes.
Alternatively facebook FQL on the Status table might provide an answer because it allows you to specify the user ID (for example, your own) for which to retrieve status updates, and a time frame can be specified to limit them as desired.
A raw fb FQL query example, for status updates:
select uid,status_id,message
from status
where uid in
(select uid2 from friend where uid1= uid)
AND time > {time in the last week}
The main FQL guide starts here.
Sample
Poking around the Internet you can pick up sample code of FQL code being called from PHP and other platforms.
PHP example:
<?php
$q = "SELECT name FROM user WHERE uid='$id'";
$query = $facebook->api_client->fql_query($q);
?>
The facebook client API library for your platform of choice can be downloaded and used to issue FQL statements.
--
There is also a Test Console hosted online for facebook developers to test API statements against their own account.
You can also use a RSS feed generator for your Facebook Statuses (or Photos) like the RSS Feeds application on Facebook.
It will help you generate a RSS feed for all your statuses and photos while maintaining the privacy modes.
Although, I am not a fan of the user interface the application has, but the functionality is what is awesome :)
Theres also anther way to do it..Which is simple and easy...its not an rss feed but a plugin can be developed to output as an rss...Theres a tutorial of it on http://Fourgefeed.com