I have a strange problem.
I have a string of ad groups ids.. it's splited by commas.
I used graph api explorer
of facebook in order to get the total spent of all of these ads.
so I call something like:
act_ACOUNTID/adgroupstats?adgroup_ids=[AD_GROUP_IDS]&start_time=
2009-05-18T07:00:00&end_time=2014-05-19T07:00:00&limit=100&offset=100
In the result there are 42 rows (total rows is 142, but I used offset
(get from the 100'th rows) and limit
(show only 100`th rows) so there is no problem yet).
In my visual, I make the same call:
int ADS_LIMIT = 100;
int offset = 100;
IDictionary<string, object> result = facebookClient.Get("/act_" + accountId +
"/adgroupstats?adgroup_ids=[" + adGroupIds + "]&start_time=" + startTime +
"&end_time=" + endTime + "&limit=" + ADS_LIMIT + "&offset=" + offset, parameters)
as IDictionary<string, object>;
var DataResult = result["data"] as List<object>;
but DataResult.Count
contains 100 rows and not 42.
can someone guess why this problem happened? (p.s. I copy and paste the string in the code to the facebook graph api and set the access token so there is no problem with it)
Any help appreciated!
facebook answered me for this issue:
In this case this is not a bug and is in fact by design. Limit and Offset
pagination is not supported across all endpoints and in the Ads API we recommend
that you instead use the "next" & "previous" paging links. This is highlighted
here:
https://developers.facebook.com/docs/graph-api/using-graph-api/v2.0#paging
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With