Alo*_*iel 4 c# facebook-graph-api
我有一个奇怪的问题.
我有一串广告组ID.它被逗号分割.
我使用graph api explorerfacebook来获取所有这些广告的总花费.
所以我称之为:
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
Run Code Online (Sandbox Code Playgroud)
在结果中有42行(总行数为142,但我使用offset(从第100行获得)和limit(仅显示第100行)所以没有问题).
在我的视觉中,我打了同样的电话:
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>;
Run Code Online (Sandbox Code Playgroud)
但DataResult.Count包含100行而不是42行.
谁能猜到为什么会出现这个问题?(ps我将代码中的字符串复制并粘贴到facebook图形api中并设置访问令牌以便它没有问题)
任何帮助赞赏!
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
Run Code Online (Sandbox Code Playgroud)