api to get uid from profile URL on facebook - 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.

Related

Facebook user ID Issue

I have facebook user ID's
using this id's am accessing profile page of that particular user id.
link will be look like https://www.facebook.com/100001533612613
this link not working now.
https://facebook.com/zuck
https://www.facebook.com/100001533612613 (**not working**)
https://www.facebook.com/profile.php?id=100001533612613 (**not working**)
https://m.facebook.com/ChrisHughes
how can i see profile using UserId
how can i access profile using UserId
You can’t, because you are not supposed to any more …
You will now need to ask for the user_link permission first, and then you can request a (temporary) link to their profile via the link field.
https://developers.facebook.com/docs/graph-api/changelog/version3.0#login

URL for Facebook album id

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.

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

Given a Facebook app's page/id, how do I find how many "likes" that app has?

farmville/frontierville/etc
How do I figure out how many "likes" these apps have?
The graph API does not work with apps.
The graph api below will show all the information related to the app
https://graph.facebook.com/159616034235/
result:
Call
https://graph.facebook.com/APP_ID
Try this example call in Graph Explorer:
https://graph.facebook.com/farmville
which will return a JSON reponse with id, name, picture, link and then likes as 5th value.
You can get the number of likes from Graph API by querying by Application id or Application namespace.
https://graph.facebook.com/APP_ID_OR_NAMESPACE
You can also limit results to be only constructed from id of an application and likes by using fields argument in URL:
https://graph.facebook.com/APP_ID_OR_NAMESPACE?fields=likes
Beware that not every application have a namespace defined and because name of application is not unique, it's better to use id of application to retrieve details from Graph API
You are wrong. The graph API does not work with apps.
http://www.facebook.com/dominodraw/
takes me to 'page not found'. So, dominodraw is not a valid facebook username.
Try graph.facebook.com/<your_app_id> and it will get likes for your app.
p.s. Just in case you are confused.
farmville is not only the name of app, but also they have registered farmville as facebook username.
So, they can do https://graph.facebook.com/farmville along with graph.facebook/208633805894647
If you havent set username for your app, you can only call graph api by app_id.

Facebook Get User ID From Application Tab

Facebook apps are allowed to have a tab that a user can add to his profile's tabs if he wants.
How can I get the uid or otherwise identify the currently logged in user in order to customize the layout for him please?
Thank you.
As noted here:
Facebook does not pass back who the viewing user is when she first visits your tab. Facebook does send the profile owner's ID in the fb_sig_profile_user parameter, so you know whose profile to display content for.
Visitor id is passed as request parameter after a user interacts with your tab. I can't find exact parameter name as they removed a wiki page that used to contain a list of all passed parameters, but if you dump all your request vars you should be able to see it (but not during the first visit).
some sources to do it + you must have turned on all items on migration in app settings
http://nathrondevblog.blogspot.com/2010/09/how-to-get-user-id-in-profile-tab.html
Try out this one,
If the user is logged in. You can directly get the user_id, session_key etc from the querystring.
long fbuid = long.Parse(Request.QueryString.Get("fb_sig_user"));