URL for Facebook album id - facebook

Is it possible to get URL for Facebook album id (fbid) without any request?
Like I can get URL for photo - https://www.facebook.com/photo.php?fbid=FBID
I need a valid URL for use with Graph API in link field.
http://www.facebook.com/FBID - is not valid, because shown as plain text in link field.

If albumid is 1256641940078, the URL is
http://www.facebook.com/1256641940078
Nodes in the Graph API have a unique ID and you can generally link to anything like this if you just know that ID. For example you can even link to a person like http://www.facebook.com/297200003

Do this:
http://graph.facebook.com/FBID?fields=link
Example: http://graph.facebook.com/537137506325516?fields=link
You better use user access token for private photo.

Related

How do I generate Facebook like button with only the FB page ID

So I have a database table with the Facebook page ID's of my users. I would like to generate a like button dynamically with only the ID available to me to do this. The problem as I see it is that I don't know what the data-href attribute is supposed to have considering that Facebook page url's look like this: http://facebook.com/pages/hyphenated-name/<?=$FB_id?> and I don't have the hyphenated name stored in my database to generate the that url.
Is there another URL structure Facebook's back-end will accept that just has the ID and not the hyphenated name, but will still count likes on that person's Facebook fan page? Is this impossible?
You can do a look up of the id, and retrieve the link of the page stored.
example: https://developers.facebook.com/tools/explorer?method=GET&path=191825050853209
refer to: https://developers.facebook.com/docs/reference/api/page/ under link connection.
This method will require use of the graph api, or one of the sdks.
refer to: https://developers.facebook.com/docs/reference/api

How to find a post when all you know is the post_id?

I have a simple app for submitting data and after submission I have a share option.
When a user actually shares something he is redirected by Facebook to a specified URI.
Facebook also provides the post_id by appending it to the URI (like http://my-redirected-URL?post_id=100001175803635_321643121201516).
So, without asking anything from the user, I can tell if he shared information or not, and I have his post_id (but not his user_id or name).
But how can I see what he actually wrote? I have his post_id. Where can I look?
I've tried the open graph but with no luck.
I thought this was an answer: what is the url to a facebook open graph post id?, also no luck.
Any ideas?
If you have user access_token for user who shared the content you can issue GET request to Graph API to get the data by post id (100001175803635_321643121201516 for example):
GET https://graph.facebook.com/POST_ID?access_token=USER_ACCESS_TOKEN
Response is the Post object which will have non empty message property if user added some text to shared content...

How to get user's id by user's profile url?

Now when the user input his personal profile url to a textbox, such as http://www.facebook.com/Google.
The form immediately show the Google logo(it's the Google's facebook paeg's logo).
If I know the page id,I can show the Google logo in this way:
http://graph.facebook.com/[USER_ID]/picture
But how to know the user id with any api?
You can get the user id by parsing the url and then going to https://graph.facebook.com/Google and parsing the json response. You can also parse the url to get the profile photo: https://graph.facebook.com/Google/picture

What is the difference between a Facebook Page "Like" and an external URL "Like"? And will the "user_likes" permission scope give access to both?

I'd like to pull a list of all Facebook "Likes" for a user, whether they are Facebook pages or external URLs.
Example:
If you "Like" the Facebook Platform, I know I can see it via the /me/likes API call.
However, if you like an external URL, I'm not sure how to pull that. Are both supposed to be pulled via the /me/likes call? Or is there another call to handle external likes?
Further, what about newsfeed / stream likes? For example, if I "Like" a photo, video, status or link that I see in my stream, is that accessible via the API? If so, how is this accessed?
Yes, user_likes will give you access to both.
You can access external likes as you wish through the Graph API endpoint /me/likes, as long as they're not articles. Objects with type "article" do not represent real-world objects and as such, we don't provide on a person's profile. We mention this (albeit obscurely) on the Open Graph documentation page: https://developers.facebook.com/docs/opengraph/#types
So if you go to my fake movie object page at
http://fbsb.hoodlu.ms/so_7436857/video2.html
and click like, that will show up when you access your likes on https://graph.facebook.com/me/likes.
Try it using the Graph API explorer:
https://developers.facebook.com/tools/explorer/?method=GET&path=me%2Flikes
If you want the URLs that someone has liked, use this FQL query:
SELECT url FROM url_like WHERE user_id = me()
More information is available at https://developers.facebook.com/docs/reference/fql/url_like/.
If you want to access the likes from a post, photo, video, etc. you'll need to use the like and stream FQL tables. To just pull out the likes (of posts/photos/videos) for the current user:
SELECT user_id, object_id, post_id FROM like WHERE user_id=me()
From there, you would query the stream table for the post to get more information.
like table documentation: https://developers.facebook.com/docs/reference/fql/like/.
stream table documentation: https://developers.facebook.com/docs/reference/fql/stream/
Facebook now has two ways to read likes. If you would like to get the likes of an external URL you try this:
http://graph.facebook.com/me/og.likes/[ID_FACEBOOKOBJECT]
And if you wish get the likes from an internal Facebook page (fan page,profile,photo like) try this:
http://graph.facebook.com/me/likes/[ID_FACEBOOKOBJECT]
Checkout: https://developers.facebook.com/tools/explorer

api to get uid from profile URL on facebook

Is there a way (using API) to get users uid from the profile URL in facebook?
The REST api has been deprecated.
The proper way to do this is to pass the profile name to the graph api
see: Facebook ID from URL
You can call the graph directly as such:
https://graph.facebook.com/username where username is the username you want to lookup.
As of today(28th July 2015), I found a different way to find Facebook user's numeric id from profile url (or username).
As you all will be knowing the profile url syntax is https://www.facebook.com/[username]
So just browse to profile url, right click to view source and search for string "uid":. You will get numeric id next to it.
Use Users.getInfo, which returns an array of user info, such as first_name, last_name, and uid. Use this call to get user data that you intend to display to other users (of your application, for example). If you need some basic information about a user for analytics purposes, call users.getStandardInfo instead.