Facebook - obtain location /places ID via location name

21,780

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

https://graph.facebook.com/search?q=ritual&type=place&center=37.76,-122.427&distance=1000&access_token=mytoken.

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.

Share:
21,780

Related videos on Youtube

Danny
Author by

Danny

Senior Developer at Reckless - a digital agency based in Chester, UK.

Updated on July 09, 2022

Comments

  • Danny
    Danny almost 2 years

    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?

  • Elad Lachmi
    Elad Lachmi about 13 years
    You can also use php sdk or JS sdk to same effect.
  • Danny
    Danny about 13 years
    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 developers.facebook.com/docs/reference/fql". Looking at the FQL Place page you linked to, it appears page_id is the only indexed column :(
  • Elad Lachmi
    Elad Lachmi about 13 years
    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.
  • Abel Callejo
    Abel Callejo about 9 years
    I can't find the document reference for that endpoint. Is this solution some kind of a black box?
  • ban-geoengineering
    ban-geoengineering about 6 years

Related