Facebook API Missing Paging Cursors - facebook

I am using the Facebook API to retrieve comments from my posts.
Most of the time, when there are more than 25 comments on a post, I am given this paging information:
{
//COMMENT DATA
"paging": {
"cursors": {
"before": "",
"after": "WTI5dGJXVnVkRjlqZAFhKemIzSTZAOekl4Tmprd016WTNNVFk0TXprNU1qb3hOalE0TmpZAM05UVXgZD"
},
"next": "https://graph.facebook.com/v12.0/165099760197787_7215028868538139/comments?access_token=ACCESS_TOKEN&pretty=1&limit=25&after=WTI5dGJXVnVkRjlqZAFhKemIzSTZAOekl4Tmprd016WTNNVFk0TXprNU1qb3hOalE0TmpZAM05UVXgZD"
}
}
Or, if there isn't another page, I get this (no "next" value):
{
//COMMENT DATA
"paging": {
"cursors": {
"before": "WTI5dGJXVnVkRjlqZAFhKemIzSTZAOekl4TlRNNU56QTJOVEUyTnprNE5qb3hOalE0TmpReE16WXkZD",
"after": "WTI5dGJXVnVkRjlqZAFhKemIzSTZAOekl4Tmprd016WTNNVFk0TXprNU1qb3hOalE0TmpZAM05UVXgZD"
}
}
}
Everything works well with the above. But sometimes, I get paging information that doesn't have ANY paging cursors despite definitely having more than 25 comments. How am I supposed to page through the data with this? Any idea why it is giving me incomplete paging data? It looks like this:
{
//COMMENT DATA
"paging": {
"next": "https://graph.facebook.com/v12.0/165099760197787_1346071832565247/comments?access_token=ACESS_TOKEN&pretty=1&limit=25&after"
}
}

Related

Facebook API campaign insights action_values

Calling the Facebook campaign insights API, I want to retrieve "action_values".
I've tried from PHP code and from tool explorer using an url like this:
XXXXXX/insights?fields=action_values
but this is the result (action_Values not appear in response)
{
"data": [
{
"date_start": "2021-02-25",
"date_stop": "2021-02-26"
}
],
"paging": {
"cursors": {
"before": "MAZDZD",
"after": "MAZDZD"
}
}
}

Return value of ads insights in graph api

I currently don't have any campaigns that have been launched with ACTIVE status in Facebook so whenever I try to query the insights endpoint I receive an empty array of data[] which doesn't allow me to do much.
I would like to know how a response would look for an adset that has been launched with an active status and actually contains insights' data, using a query like this one:
GET graph.facebook.com/v8.0/{adset_id}/insights?date_preset=lifetime&fields=reach,unique_ctr,cpm&access_token={access_token}
I think is that it might look something like this, but I would like to get the exact response structure:
{
"data": [
{
"name": "metric_name",
"values": [
{
"end_time": "some_date_string",
"value": numeric_string,
}
]
}
]
}
I've made <adset_id>/insights?date_preset=lifetime&fields=reach,unique_ctr,cpm
Example output:
{
"data": [
{
"reach": "12739",
"unique_ctr": "1.420834",
"cpm": "13.740269",
"date_start": "2020-02-25",
"date_stop": "2021-01-28"
}
],
"paging": {
"cursors": {
"before": "MAZDZD",
"after": "MAZDZD"
}
}
}

Combining multiple facebook page reviews feeds in one call

How is it possible that I can add another access token to this call that references the second id I would like to retrieve reviews from.
In all other instances like posts, photos etc this would work but because you are required to have a page access token to retrieve the data for reviews I'm not sure how to construct the url to make the call. Is it possible?
https://graph.facebook.com/ratings?ids=slickremix,reformavi&field=rating&limit=5&access_token=EAAP9hArvboQBAN5...
That call returns something like this, as you can see the second id reformavi is not returning data.
{
"slickremix": {
"data": [
{
"created_time": "2016-10-13T09:22:02+0000",
"reviewer": {
"name": "Jens Kranen",
"id": "10211267740634296"
},
"rating": 5,
"review_text": "Fantastic customer support. Very quick response. Spencer could identify the problem within minutes and gave great advice.\nThank you"
},
{
"created_time": "2016-10-07T14:22:19+0000",
"reviewer": {
"name": "Marc McHale",
"id": "10157614348555341"
}
"rating": 5,
"review_text": "I purchased the Facebook Reviews plugin for a client website and both my client and I are very happy with the appearance and functionality! Plus, the customer service was outstanding!"
}
],
"paging": {
"cursors": {
"before": "MTM4MjkwMTM4ODoxMTg3OTA3NTE1MjU4ODQZD",
"after": "MTI1MTQ3Njk2NToxMTg3OTA3NTE1MjU4ODQZD"
},
"next": "https://graph.facebook.com/v2.7/118790751525884/ratings?access_token=EAAP9hArvboQBAN5HpnbA5m87qC7poAAqB0YS47zxBCBmCfVRcqCC7zX1XDNCv6cSe3KFnMtPVysUms0MuXLxWfv8D9McMwzvD2HWWd0IO6FOZC6ogvcta8FWZBR0vUA9HCZAdqdB53fyUB26XLb76ORLspiPg3Hzb4Pn5RTjwZDZD&pretty=1&limit=5&after=MTI1MTQ3Njk2NToxMTg3OTA3NTE1MjU4ODQZD"
}
},
"reformavi": {
"data": [
]
}
}

How can I get facebook event photos urls using Graph API?

I'm playing with facebook explorer to get event photos urls.
For {event-id}/photos I get something like:
{
"data": [
{
"created_time": "2015-12-07T20:53:44+0000",
"name": "1913 rok.",
"id": "178797088851556"
}
],
"paging": {
"cursors": {
"before": "OTc4Nzk3MDg4ODUxNTU2",
"after": "OTc4Nzk3MDg4ODUxNTU2"
}
}
}
How can I exctract this photo (id: 178797088851556) url?
It´s called "Declarative Fields":
/{event-id}/photos?fields=name,source
Check out the API reference for all available fields.

Facebook Graph get photos of public page pagination

I successfully managed to retrieve first 50 photos of a public page via FBGraph but can't make pagination work
1525666877712653?fields=albums{id,photos.limit(50){name,picture}}
Here's, for example, how I get them from CocaCola's public page. But how can I get 50 more?
When doing
1525666877712653?fields=albums{id,photos.limit(50){name,picture}}
You will get:
{
"data": [
... Endpoint data is here
],
"paging": {
"cursors": {
"after": "MTE1NzQxNDAwODUwNA==",
"before": "MTU0MjU3NDQ3NzI3NQ=="
},
"next": "https://graph.facebook.com/v2.3/1525666877712653/albums?fields=id,photos.limit(50){name,picture}&limit=25&after=MTE1NzQxNDAwODUwNA=="
}
And use the query you can get from the next field to get the results from 50 to 100. You will see that the filters are the same as in your initial query.