Logo Questions Linux Laravel Mysql Ubuntu Git Menu

graph api explorer doesn't return the same as the Get response from the visual

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:


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!

like image 743
Alon Shmiel Avatar asked Mar 19 '23 14:03

Alon Shmiel

1 Answers

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
like image 89
Alon Shmiel Avatar answered Mar 25 '23 04:03

Alon Shmiel