These days I have had the pleasure to play a little bit with the facebook api, but there are things that I can not understand. I'm searching for all the pages that are close to some point, using this FQuery (Query1):
SELECT page_id,name FROM place WHERE distance(latitude, longitude, "45.698944", "8.462454") < 50000
This query returns a list of pages, but not all. For example, this query (Query2):
SELECT page_id,name,distance(latitude, longitude, "45.698944", "8.462454")
FROM place
WHERE distance(latitude, longitude, "45.698944", "8.462454") < 50000 and page_id=656799421018484
returns:
{
"data": [
{
"page_id": "656799421018484",
"name": "Formatamente",
"distance_meters": 16006.10107316
}
]
}
My problem is that Query1 not return "Formatamente" (result of Query2) though the distance ( 16006.10107316 ) is less than 50000.
I also tried facebook graph:
https://graph.facebook.com/search?distance=50000¢er=45.698944,8.462454&type=place&fields=id,name&access_token=TOKEN
but it still not returning "Formatamente".
Is there some trick to find all places around me? I will use this page_id to search all events created by this pages, or is there an easier way to find events nearest gps point?
Thanks in advance
Have a look at my answers
Facebook Graph API Get All Events For Latitude and Longitude
Facebook FQL find all events that take place at a certain venue
You're not getting the specific Page you mentioned because your're using the biggest radius possible (50000m), which yields in probably tens of thousands results (which FB is not returning completely). You can use LIMIT start, number in your query, but still FB won't return a high five-digit amount of results at once.
Related
I did this query: SELECT id, username, name, pic_square FROM profile WHERE contains('Restaurants in Vilnius, Lithuania'), as a result I got only 23 results. Hovewer if I search for Restaurants in Vilnius, Lithuania search box, in facebook, I get around 200-400 results. Why is that so ?
Facebook limits the API result to 25 items max and you need to use paging to get the next batch: https://developers.facebook.com/docs/graph-api/using-graph-api/v2.2#paging
You really shouldn´t use FQL anymore, it will be gone for good after August 2016. Always use the Graph API: https://developers.facebook.com/docs/graph-api/using-graph-api/v2.2#search
I am trying to use limit along with since and until in Graph Api call. In between a certain time interval, I have 2 uploaded photos. The query looks like this:
me/photos/uploaded?since=2009-12-31T18%3A30%3A00.000Z&until=2010-12-31T18%3A30%3A00.000Z&limit=200
This query has limit set as 200 , and it correctly returns the 2 photos. But the problem arises when I have a smaller value of limit, lets say 100. So basically a query:
me/photos/uploaded?since=2009-12-31T18%3A30%3A00.000Z&until=2010-12-31T18%3A30%3A00.000Z&limit=100
return me an empty json. Even though there are only two photos, a limit of 100 returns null. Any insights?
I want to get comments count, likes count and shares count for a page posts. I have their IDs and I'm trying to figure something out with the Graph API or FQL, but in vain.
For regular posts I can query the stream FQL table and I get the comment_info, like_info structures and shares_count variable.
For posted photos I can query the photo table and I get from there comment_info and like_info, but it lacks the shares_count.
I tried using Graph api like that: GET /550045508388715 and it returns a ton of information, but nothing related to share count.
I've googled that issue, but did not found any relevant solution.
Instead of GET /ID use GET /POST_ID to get the shares count (if >1). You'll get the result as-
"shares": {
"count": x
}
Note- the Post ID is generally: USERID_PHOTOID ORPAGEID_PHOTOID
I'm trying to query every object which the user has liked since joining facebook by running this query:
SELECT user_id, object_id, post_id FROM like WHERE user_id=me()
This query runs fine and returns some results, but the number of them is a lot less than I estimated. I tried it on different, real user accounts, and for a friend of mine who has joined facebook around 2006 the number of returned results is still only around 65.
I tried this query through the official javascript sdk and through the graph api explorer which gave identical results.
The documentation doesn't state any limit imposed upon querying the like table.
Is there anything, I should be aware when doing a query on this table?
Thank you very much!
According to this documentation :
Each query of the stream table is limited to the previous 30 days or
50 posts, whichever is greater, however you can use time-specific
fields such as created_time along with FQL operators (such as < or >)
to retrieve a much greater range of posts.
Although not explicitly mentioned in the doucmentation for likes, I guess this will be the same limit. So try to add created_time in a where clause.
I'm trying to get some statistical data from my page using FQL like so:
SELECT metric, value FROM insights WHERE object_id=278942378807967 AND metric='page_fan_adds' AND end_time=1327903200 AND period = 2592000
However all that is returned is:
{
"data": [
]
}
I also tried different dates and periods, most of which I'm pretty sure there should be data presented...
You're probably missing a valid access token on your query to get the stats.
period can only be 86400 or period("day")