Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Get "real" profile URL from Facebook Graph API /user

Tags:

As stated in the API docs for /user, the link field contains the user's profile URL. However, this URL commonly redirects to a different URL (i.e. the one that shows up in Google results).

Is there any way to determine the final redirect location (the "real" URL) of a given profile via the Facebook API?

For example, given:

"link":"https://www.facebook.com/1091552020"

I want to retrieve https://www.facebook.com/sbhutiani from the API

like image 220
jchook Avatar asked Mar 19 '15 18:03

jchook


People also ask

How do I find my Facebook profile URL?

You can find a Facebook URL in the address bar at the top of the browser if you are using a computer. To find the URL for a personal page in the mobile app, tap the three-dot menu and find the address in the Profile link section.

What data can I get from Facebook graph API?

The Graph API is the primary way to get data into and out of the Facebook platform. It's an HTTP-based API that apps can use to programmatically query data, post new stories, manage ads, upload photos, and perform a wide variety of other tasks.

Is Facebook graph API deprecated?

API Version Deprecations: As part of Facebook's Graph API and Marketing API, please note the upcoming deprecations: August 3, 2021: Graph API v3. 3 will be deprecated and removed from the platform. August 25, 2021 Marketing API v9.


1 Answers

You can´t get the real ID or the username of users anymore, so there is no way to get the "real URL". More information: https://developers.facebook.com/docs/apps/changelog

You can get a link to the user profile with the following API call though: /me?fields=link

Check out "App Scoped IDs" in the Facebook docs.

Update: It seems that linking to the user profile is not possible anymore: https://developers.facebook.com/blog/post/2018/04/19/facebook-login-changes-address-abuse/

like image 161
andyrandy Avatar answered Oct 21 '22 23:10

andyrandy