Graph api explorer does not return the same as Get answer from visual

I have a strange problem.

I have an ad group ID string. It is separated by commas.

I used graph api explorerfor facebook to get the total amount of all 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

As a result, there are 42 lines (142 lines in total, but I used offset(get from the 100th line) and limit(show only 100 lines), so there is no problem so far).

In my application, 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.Countcontains 100 lines, not 42.

Can anyone guess why this problem occurred? (ps I copy and paste the line into the code in the facebook api chart and set the access token so that there are no problems with it)

Any help appreciated!

+4
2

facebook :

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
+5

( :) , , , , - , - .

:

Console.WriteLine("Created String: " + 
    "/act_" + accountId +
    "/adgroupstats?adgroup_ids=[" + adGroupIds + "]" +
    "&start_time=" + startTime + 
    "&end_time=" + endTime + 
    "&limit=" + ADS_LIMIT + 
    "&offset=" + offset);
  • ( ), -
  • , , ( )
  • , . , , , , facebookClient.Get(..) ...

, , SDK -, api, . ( SO ^^)

+1

Source: https://habr.com/ru/post/1541017/


All Articles