graph.facebook.com/username does not work - facebook

I tried to get user detail using https://graph.facebook.com/username . But it throws an error
"error": {
"message": "(#803) Cannot query users by their username (ramesh.randika.56)",
"type": "OAuthException",
"code": 803
}
does anybody have a solution for this problem.

graph.facebook.com/{Username} is not avaiable now but lookup-id.com still can find your facebook ID, facebook group ID and facebook page ID

"View page source" Option in every web browser will help you.
Follow this-
Open the timeline of that person/FB account.
Right-click anywhere on the web-page->View page Source-> wait 1 or 2 seconds to load the new page.
Press Ctrl+f (used to find any string,word in the page) then type " profile_id= " (without quotes).
Copy the long number after " = ", .
Conclusion : Using the "username" doesn't work anymore (Updated till Oct 2018),profile_id is the thing u needed instead.

The username field was removed with the introduction of the Graph API v2.0.
See
https://developers.facebook.com/docs/apps/changelog#v2_0
/me/username is no longer available.

Related

Facebook Graph API Updating Privacy Parameter

Context:
I have a facebook page with a post
I want to hide that post from anyone accessing the page (other than me) using the Facebook API
This can be achieved using the privacy field with "SELF"
Problem: Before I can even use it in my application, I cannot get a working example in the Graph API Explorer. I am using:
POST /v2.7/POST_ID?privacy={"value":"SELF"}
This works with other properties such as message, but despite many attempts, when I am able to actually set the privacy value property I always get the following message:
{
"error": {
"message": "(#100) Failed to edit object",
"type": "OAuthException",
"code": 100,
"fbtrace_id": "DkL5f4bzK2E"
}
}
Question: Can anyone provide a working example?
References:
Graph Explorer: https://developers.facebook.com/tools/explorer
Privacy Parameter: https://developers.facebook.com/docs/graph-api/common-scenarios#privacy-param
After asking Facebook Support Team if it was a bug, it is not, their answer:
You cannot edit the privacy of a post on a page . You can choose to
publish / unpublish it , if needed.
To change the audience of the page itself, you will need to edit the
settings of the page.
This is by design.
You can also see their answer directly: https://developers.facebook.com/bugs/152272141874454

How do I search Facebook for all users at a certain location using Graph-API

I have a project where I have to search Facebook for all people at a
certain location and then apply further filters to the data. My problem and question is:
How do I get the initial data, using Graph API?
I know that it is possible, using the search field in Facebook itself. Just typing "All people living in ???" returns a list of people.
I couldn't find such functionality in the Graph-API of Facebook. Here is what I tried:
I modified some parameters of the standard search request
search?type=user&center=52.946758,-1.172882&distance=1000
search?type=user&center=Nottingham&distance=1000
and here is what I got:
{
"error": {
"message": "No node specified",
"type": "GraphMethodException",
"code": 100
}
}
Using a similar query with location instead of center
search?type=user&location=Nottingham&distance=1000
search?type=user&location=52.946758,-1.172882&distance=1000
search?type=user&q=&location=Nottingham
and only got a confusing error that the location I wrote is wrong
{
"error": {
"message": "(#160) Invalid coordinates. Coordinates must contain at least latitude and longitude.",
"type": "OAuthException",
"code": 160
}
}
Then searching for a user with the coordinates as query parameter returned an empty result.
search?type=user&q=52.946758,-1.172882&distance=1000
{"data": []}
Then I tried to search for a correct location to pass to the location parameter of the query
search?type=location&q=52.946758,-1.172882
and I only got a deprecation error
{
"error": {
"message": "(#12) location search is deprecated for versions v2.0 and higher",
"type": "OAuthException",
"code": 12
}
}
I don't know how to get to this. If someone could tell me, how to get this information, it would help
me a lot, since I don't know what to try next.
I have found this question similar to my problem, but the accepted answer isn't really answering the question
Facebook Search API - List all users based on location?
You can either search for a location OR search for a user, but you can definitely not search for "all users in an area". The Graph search on Facebook can handle a lot more things that you will never be able to get with the API. Think about privacy, i would not want any app to know if i am nearby, without even authorizing the App ;)
Facebook docs: https://developers.facebook.com/docs/graph-api/using-graph-api/v2.2#search
For getting the locatoin where the user is living, you need to check out the user reference: https://developers.facebook.com/docs/graph-api/reference/v2.2/user
There is a "location" field in there, you need to authorize a user with the "user_location" permission to get that information. It is not possible to get that information from any user. Just because you can see data on Facebook and it is public does not mean you can access it with an App, for privacy reasons this is only possible by authorizing the user.
Scraping without an App is not allowed btw, check out the scraping terms: https://www.facebook.com/apps/site_scraping_tos_terms.php
I tried this -> "firstname lastname location" and it works perfect.
For example -> "Sameeksha kumari australia"
The query looks like this
https://graph.facebook.com/v2.5/search?fields=id,name,picture.type(normal),location&limit=500&q=sameeksha kumari melbourne&type=user&access_token=token

Getting page photos with Facebook Graph API

I'm using Facebook Graph API here: http://crackit.seegermattijs.be/wedstrijd.html I'm trying to get access with the following url: https://graph.facebook.com/10150146071791729/photos
This was working for 2 weeks but all of a sudden I always get following error
{
"error": {
"message": "An access token is required to request this resource.",
"type": "OAuthException",
"code": 104
}
}
Is there anyone who can figure this out?
Kind regards
Seeger
Try this ....
https://developers.facebook.com/tools/explorer/?method=GET&path=10150146071791729%2Fphotos
I'm using 'Graph API Explorer', that's no problem.
"message": "An access token is required to request this resource."
This message means "You're not logged in with Facebook"
You need to renew your Access Token.
Ensure that you are an Admin of the Facebook Page.
go to :
http://developers.facebook.com/tools/explorer
In the API Navigator, you can see "/me" will bring up the basic information of yourself.
Try typing in "/me/accounts" to see if you can see anything. It should give you an error.
Click on "Get Access Token"
a window will pop-up. Navigate to "Extended Permissions"
Select "manage_pages"
Click "Get Access Token"
Now try "/me/accounts" again. You should see a list of Groups inside the viewing window.
Select the Page you want, and click on the "id" field
Next, on the left window, you can see "Node: " and a + sign. Click on the + sign to see what are the options you have.
Click on the + sign and scroll down to "connections" and select "Albums"
The child-level, select "Photos"
The "Photos" child-level, select "source"
Now click "Submit" on the right hand side. You will see a JSON returned with the url of all the photos in your Facebook Page.
Copy the URL - https://graph.facebook.com/?fields=albums.fields(photos.fields(source)) and plug it into your browser. You should see a JSON of all your photos.

Cannot publish an action required to submit it to create an FB app

I have created an facebook app, took built-in action (read) and object (article), also back at my web site properly inserted meta og: tags, only thing left to do is to publish at leaste one action to my timeline and submit my action, but every time I try "https://graph.facebook.com/me/namespace:read?article=correctURL&access_token="access token copied from the "Get code" dialog at Open graph settings", and it returns me this message
{
"error": {
"message": "Unknown path components: /appnamespace:read",
"type": "OAuthException",
"code": 2500
}
}
Is this a facebook bug at the moment, or am I just doing something wrong here? Is there any precise way to deal with this?
According with the "Get code" dialog at Open graph settings, the uri should be
https://graph.facebook.com/me/news.reads?article="...."&access_token="..."
The namespace should be used only with custom actions.

Getting an Error - Trying to show wall on my website

I'm getting the error below for the graph API call:
https://graph.facebook.com/[MYID]/feed?limit=100&access_token=[TOKEN]
{
"error": {
"message": "SETTINGS: Unrecognized pref_type 0 for NullProfileSettings pref name default_non_connection_tab.",
"type": "Exception"
}
}
You should check and recheck your app id.
I had a same problem for few days untill I realized that the app id was wrong.
Go to Graph API Explorer in facebook developer page.
Type in your app id and check if in the result is
a) Your page name
b) Id is the same as you typed in. If not then you should use that one instead.
Hope that helps