Search for places with an App Access Token suddenly stopped working - facebook

i am calling the graph API with an App Access token (grant_type=client_credentials) to search for places on facebook. Quering for
https://graph.facebook.com/search?type=place&center=50.785361,6.0334127
Used return the search result reliably but suddenly stopped working with the following error:
{
"error": {
"message": "An unknown error has occurred.",
"type": "OAuthException",
"code": 1
}
}
I have tested the call on the Graph API Explorer. With my facebook user's access token the request still returns the desired data. Other requests with this app access token still work, so the token is good.
Any ideas?

Related

An accessToken issue using the Graph API

I'm trying to make a GET request from the Facebook Graph API, graph.facebook.com (using Postman, a Chrome application) to get all events containing the key word as below:
graph.facebook.com/v2.8/search?pretty=0&q=<MY_CITY>&type=event&accessToken=<MY_APP_ACCESS_TOKEN>
I'm having this response from Facebook:
{
"error": {
"message": "An access token is required to request this resource.",
"type": "OAuthException",
"code": 104,
"fbtrace_id": "B5KWVqr7ajK"
}
}
I've rechecked my app_access_Token, and it's fine and works for other requests. How can I fix this problem?
https://developers.facebook.com/docs/graph-api/using-graph-api/#search:
All Graph API search queries require an access token included in the request. You need a user access token to execute a search.

How to get the result in Facebook Graph Api Explorer.? Getting error message (#15) This method must be called with an app access_token

I was Unable to get the search result in Facebook Graph Api Explorer For Topic search API. I am getting the following error. I also have the access token included.
{
"error": {
"message": "(#15) This method must be called with an app access_token.",
"type": "OAuthException",
"code": 15,
"fbtrace_id": "CJiZqVSATXu"
}
}
Well, the error message actually contains the problem. You're not using an App Access Token, but seemingly an User Access Token (from the Access Token structure in your screenshot).
You must select an app of yours in the upper right Applications dropdown, and then select Get App Token in the dropdown below.
Still, that will probably not help much in this case. Are you aware that only whitelisted apps can use the Topic Search API?
See
https://developers.facebook.com/docs/graph-api/using-graph-api#search
https://developers.facebook.com/docs/mediasolutions/topic_search/v2.5

Getting User Birthday HTTP Request

Im trying to get birthday on the server side of my app.
I have already the ["user_birthday"] permission on my login request.
But now on the server i need to do something like this i guess.
userBirtdhay = "https://graph.facebook.com/me?fields=birthday&" + user.services.facebook.id;
But this results something like.
https://graph.facebook.com/me?fields=birthday&10146450841965723dffsadf
And if you go to the url you get a
{
"error": {
"message": "An active access token must be used to query information about the current user.",
"type": "OAuthException",
"code": 2500
}
}
After Some research got that the me space on the url should be my accessToken so i try with .
https://graph.facebook.com/longAccesToken?fields=birthday&
But it returns now.
"message": "(#803) Some of the aliases you requested do not exist:
This would be correct:
https://graph.facebook.com/me?fields=birthday&access_token=[your-user-token]
You should start reading the Facebook docs about Access Tokens and API endpoints. You can test the API with the API Explorer.

Facebook Open Graph event search

On Graph API Explorer I can do this search: search?q=Barcelona&type=event
But when I try the same with my app access token I get this error:
{
"error": {
"message": "(#200) Must have a valid access_token to access this endpoint",
"type": "OAuthException",
"code": 200
}
}
The other searches work well.
UPDATE 2017-11-27:
As Facebook doesn't allow an event search based on location anymore, I'd recommend to use https://github.com/tobilg/facebook-events-by-location-core
Original answer:
Please refer to https://developers.facebook.com/docs/reference/api/search/#access_tokens
There, it's stated that all searches except for pages and places require an user access token.

How to get real time updates for a facebook group's feed?

I am trying to write a script which will read from one of my Facebook group's feeds.
Currently Facebook's Real time subscriptions using the dashboard seem to be available only for 'user', 'page' and 'payments' objects. (https://developers.facebook.com/docs/reference/api/realtime/#subscribingviaappdash)
Also when I try to get my current subscriptions using a GET request in the Graph API Explorer
https://graph.facebook.com/APP_ID/subscriptions?access_token=ACCESS_TOKEN
I get the following error even though I am using the app's access token in the request:
{
"error": {
"message": "(#15) This method must be called with an app access_token.",
"type": "OAuthException",
"code": 15
}
}
How do I proceed?