I'm able to return a location's details by sending a query via the graph api with the location's ID, however I'm looking to achieve the reverse - effectively find location id by sending a request containing the location name (city, state etc). Is this possible?
3 Answers
This is possible under a few different approaches. You can either search using long / lat positions and put the place name into the query. This search will search places only.
Do the following
This will return ritual coffee.
Another way is to search through facebook pages using the following https://graph.facebook.com/search?q=ritual%20coffee&type=page&access_token=mytoken
This way is more difficult as you will obviously need to parse the list in more detail.

- 21,163
- 21
- 69
- 92
-
I can't find the document reference for that endpoint. Is this solution some kind of a black box? – Abel Callejo Mar 08 '15 at 03:52
-
`(#12) Place Search API is deprecated for third parties effective v8.0 is deprecated` what type of access token can we use if the endpoint still exists ? – Cyril Duchon-Doris Jul 04 '23 at 16:16
You also can use the place sdk from facebook:
compile group: 'com.facebook.android', name: 'facebook-places', version: '4.30.0' // For latest version, see https://developers.facebook.com/docs/android/
and then:
PlaceSearchRequestParams.Builder builder = new PlaceSearchRequestParams.Builder();
builder.setSearchText("Cafe");
builder.setDistance(1000); // 1,000 meter maximum distance.
builder.setLimit(10);
builder.addField(PlaceFields.ID);
GraphRequest request = PlaceManager.newPlaceSearchRequestForLocation(builder.build());
request.setCallback(new GraphRequest.Callback() {
@Override
public void onCompleted(GraphResponse response) {
// Handle the response. The returned ID in JSON is the placeId.
}
request.executeAsync();

- 18,324
- 27
- 171
- 253

- 93
- 1
- 10
-
More info here: https://developers.facebook.com/docs/places/android/search – ban-geoengineering Feb 24 '18 at 21:42
If I understand your question correctly you can use fql: https://api.facebook.com/method/fql.query?query=QUERY where query should be something like this: select page_id from place where name = ;
Here is a page for your refrence: http://developers.facebook.com/docs/reference/fql/place/

- 10,406
- 13
- 71
- 133
-
-
Thanks for the answer Elad. Unfortunately though, it's not a working solution - I receive this error: "Your statement is not indexable. The WHERE clause must contain an indexable column. Such columns are marked with * in the tables linked from http://developers.facebook.com/docs/reference/fql". Looking at the FQL Place page you linked to, it appears page_id is the only indexed column :( – BrynJ Mar 27 '11 at 18:14
-
Well then I guess there is no solution for this within the facebook architecture. Theoreticlly, you could create your own database by selecting * from the places table from 1 to whatever, but that seems like a bad solution. – Elad Lachmi Mar 27 '11 at 19:56