Searching for facebook groups by keyword using the graph API - facebook-graph-api

I wanted to find some facebook groups based on keywords and with a particular number of total members. So I was trying to fetch this data using the graph API. I tried this on the graph explorer:
search?q=keyword&type=group
Using user access token. I get the error:
"message": "An unknown error has occurred.",
"type": "OAuthException"
I created an app on facebook and I used that to get a User Access Token on the graph explorer UI itself. What must I be doing wrong?
Also, when I do the same for type=page, I always get an empty list for any keyword.

Related

Instagram Graph API Get Follower Count

I'm currently playing inside the Graph API Explorer to retrieve some data from the Instagram API. My app is set up in Facebook Developer. All I want is to retrieve followers_count from a given username.
Inside the Graph API Explorer, I have connected my App, have an access token, and set up permissions per the Instagram API Reference page (https://developers.facebook.com/docs/instagram-api/reference/ig-user/).
When I run my query inside the tool I'm getting an error that says I'm still missing permissions:
"message": "(#100) Missing permissions",
"type": "OAuthException",
"code": 100,
I currently have set some extra permissions just to see if perhaps their documentation isn't up-to-date but still no luck:
read_insights
pages_show_list
business_management
instagram_basic
instagram_manage_insights
pages_read_engagement
Have you tried adding pages_read_user_content and pages_read_engagement

Unable to retrieve data from facebook graph url for a page

Check out:
https://www.facebook.com/MitraJyothiorg
It is a page of an NGO.
Correspondingly, I should be able to find data of the page in:
http://graph.facebook.com/MitraJyothiorg
This does not seem to work. Any clues?
Please note: I am doing a simple http call and it usually works for other pages, for example, if i do the same thing for another page:teachforindia
The error message is quite clear:
{
"error": {
"message": "Unsupported get request. Please read the Graph API documentation at https://developers.facebook.com/docs/graph-api",
"type": "GraphMethodException",
"code": 100
}
}
You need to add at least an App Access Token. See
https://developers.facebook.com/docs/graph-api/reference/page#Reading
For pages that are published, you need:
An app or user access token is needed to view fields from fully public pages.
A user access token is needed to view fields from restricted pages that this person is able to view (such as those restrict to certain demographics like location or age, or those only viewable by Page admins).
A page access token can also be used to view those restricted fields.
I am not able to access that page (get a 404 error). Maybe the page is still hidden? Then you will not be able to access it via the graph API imho.

Unable to perform Graph user search using API Explorer

I'm having an issue getting the graph search to work when I manually use the Graph API Explorer to generate an access token for myself against my application.
I've created an application, set the sandboxed mode to 'off', and then manually granted my user account permissions to my application. To be safe, I included all the permissions available in the graph API explorer before generating the access token.
When I click on my access token, I see that it is still valid, and has all the permissions listed, however, when I perform the following search:
/search?q=myphonenumber&type=user
I get an error saying:
{
"error": {
"message": "(#200) Must have a valid access_token to access this endpoint",
"type": "OAuthException",
"code": 200
}
}
I know the above search code is valid because I was able to get it working a few days ago, I can't seem to figure out what has changed. Am I missing a permission somewhere that prevents me from using my access token to do an API search?
UPDATE: I should also mention that normal /me queries work just fine, it seems to be only the search which is disallowed.
I got the same problem when searching for email addresses using the same search term. While researching the problem, I found this bug report: https://developers.facebook.com/bugs/453298034751100?browse=search_516534c213df06064266897. So Facebook is aware of the problem but nothing has changed for more than a week now.

Facebook Graph API Batch Requests - Retrieve Friends Likes returns unknown error

I'm accessing the Graph API using batch requests, while trying to retrieve all of my friends likes the plataform returns-me a unknow error. By the way i'm using JSONPath to retrieve the likes.
likes?ids={result=friends:$.data.*.id}
Is this an security related question or a bug?
Ensure your access token has friends_likes by using the linter: https://developers.facebook.com/tools/debug

Facebook Graphi API does not list page accounts in offline mode

My offline Facebook application is trying to retrieve the accounts associated with a specific user id who has previously authorized the application:
https://graph.facebook.com/(userid)/accounts?access_token=(token)
Even though I am passing a valid access token, Facebook returns:
OAuthException: An access token is required to request this resource.
I verified that my access token is correct by querying the likes connection with the same userid and access token:
https://graph.facebook.com/(userid)/likes?access_token=(token)
For this second statement, Facebook returns the expected result.
My application has manage_pages and offline_access permissions. The access token I am using is the access token Facebook returned when the user authorized the application. I don't understand why it works for the likes connection but not for the accounts connection.
Facebook provides different access tokens, some are shorter and some are longer. Without realizing the difference, I had used the shorter ones, created as type='client_cred'. These work fine for retrieving friends lists, lists of fan pages, publishing to stream etc. but apparently they do not work for getting accounts information.
Here is an example of both types of access tokens. Apparently the first one lacks session information (which is the middle part of the second access token).
116122545078207|EyWJJYqrdgQgV1bfueck320z7MM.
116122545078207|2.1vGZASUSFMHeMVgQ_9P60Q__.3600.1272535200-500880518|EyWJJYqrdgQgV1bfueck320z7MM.
If your access token is wrong facebook returns this:
{
"error": {
"type": "OAuthException",
"message": "Error validating access token."
}
}
It seems that the token is not passed to the graph api. Depending on which SDK you use to pass the token, there are different errors that can occur. The PHP SDK for example ignores the token you pass and tries to get the token from the session cookie, which causes errors. Could you clarify how are you making the graph api calls?
I have verified that with a valid token you can get the accounts data. Have you tried pasting this into your browser https://graph.facebook.com/(userid)/accounts?access_token=(token)?