I know about the LIMIT option of FQL. But I need the same functionality like the Graph API that returns <= number of results spcified by the limit parameter but if there are more results there are links to get to these results like
"paging": {
"previous":
"https://graph.facebook.com/chickfila/posts?limit=5&since=1298995597",
"next":
"https://graph.facebook.com/chickfila/posts?limit=5&until=1293899704"
}
Can this be achieved using FQL?
Thanks in advance!
With the FQL queries, you won't get a "automated" pagination like with the Graph API. The equivalent functionality to since and until can be build by using the relevant time-based fields of the according tables in FQL.
You can have a look here for an introduction:
https://developers.facebook.com/blog/post/478/
https://developers.facebook.com/docs/graph-api/using-graph-api/#paging
Related
How to get data from the time range 2020-05-06 to 2020-06-06?
This query does not work:
<ACC_ID>/ads?time_range={'since':'2020-05-06','until':'2020-06-06'}&fields=insights{cpc,spend}
I suggest you to use the Insights Marketing API that support filtering, sorting and useful aggregation level, in your case, should be something like:
act_XXX/insights?level=ad&fields=cpc,spend&time_range={'since':'2020-05-06','until':'2020-06-06'}
Other info here
I use facebook graph api and I encountered a problem relating to likes.
My request:
My goal is to find the count of the like. but the query timeout. What is the solution?
Thanx
My goal is to find the count of the like
So you only want the overall number of likes, the counter, but not the individual likes?
Then you should ask for the summary via field expansion:
/{page_id}/feed?fields=likes.limit(0).summary(1)
For each feed item, you will get a likes data structure that looks like this:
"likes": {
"data": [
],
"summary": {
"total_count": 12345
}
}
Try the options below.
Uncheck all the boxes and make the request again, if you give no error, go marking one by one until you find the problem.
Try not to use the limit (999999) is very, I've had problems trying to get as much information in one query page.
Make sure your access token created this with all the necessary permissions to your query.
I confess that I have never seen this error in the Graph API, is very generic and it is difficult to give you a more accurate suggestion.
I'm trying to perform a simple pagination based on time through a facebook endpoint. I was getting results that didn't match my since.
An example call <username>/statuses?since=1390176000
returns this pagination:
"paging": {
"previous": "https://graph.facebook.com/8489236245/statuses?since=1390500000&limit=25&__paging_token=<num>",
"next": "https://graph.facebook.com/8489236245/statuses?limit=25&until=1390250670&__paging_token=<num>"
}
My expected behavior was that after a query with since I will iterate on next till I reach NOW. But when doing the query they provide with until=1390250670 I actually get OLDER results. Is there any logical explanation for this? Should I just use the previous paging ?
As you are looking at the user's statuses, the pagination is reversed as the data is ordered in reverse chronological order. The newest entries are always on the first page, so paginating to the next page will always give you older entries.
Unfortunately, the Facebook documentation doesn't mention the ordering for this API call.
I am performing a rest call to facebooks search API using type=event
e.x.
search?fields=id,name,picture,owner,description,start_time,end_time,location,venue,updated_time,ticket_uri&q=concert&type=event
I have looked through the documentation and still have a few questions about specific pagination behavior of the event search API.
If I used a broad search term like "ma" and keep querying the pagination ['next'] URL would I cycle through all facebook events starting with "ma"? Does the pagination array give any indication when there are no more results to return?.
Do these searches include past events? If so is it possible to eliminate past events using the "since" parameter?
What is the maximum for the limit parameter?
Update:
As far as I can tell the number of pages you can get from a facebook search is limited to 500. This includes pages that can be accessed via pagination. In other words a query with limit >=500 will not return a pagination url, likewise a query with limit 250 will only return one pages worth of pagination.
You will "next page" until the count of results comes less then the limit
I'm not sure if that is possible using a simple Graph Request. Maybe using FQL
I don't know exactly. But i used a 2000 limit one day. And it worked.
Other doubts you can get answers testing your resquests with this tool
https://developers.facebook.com/tools/explorer/
I am also doing the same thing like you. I am collecting public post using graph search api.
When there are no results available or you reach max limit pagination section will not be there in response. So you can always check for paging is there in json response or not something like this.
NextResult = DeserJsonFBResponce.paging != null ? DeserJsonFBResponce.paging.next : string.Empty;
I am not so sure about this with events but for public post i am able to eliminate post using science and until parameters.
Maximum for the limit parameter is 2000 per get request.
Is it possible to query more than one insights metric in one API call?
For example to get the daily added likes for a page I executed the following call:
https://graph.facebook.com/_object_id_/insights/page_fan_adds_unique/day/
But I would like to have another metric, e.g., page_fan_removes_unique, included as well.
Query the insights object entirely is a possibility, but gives me too much data I don't need, thus decreases performance.
Since your question shows that you're using the Graph API, you may want to use the batch requests method: http://developers.facebook.com/docs/reference/api/batch/
You can group multiple Graph API queries together so you can just query the Insights data you need in one request.
Yes, you can run a multiple FQL query in one API call and then parse the various results.
multi query: http://developers.facebook.com/docs/reference/rest/fql.multiquery/
insights table: http://developers.facebook.com/docs/reference/fql/insights/