如何通过过滤参数按 data_source 类型和子类型过滤 Facebook 自定义受众 GET 请求
How to filter Facebook custom audience GET request by data_source type and subtype via filtering parameter
我正在尝试过滤我们通过此端点获得的 Facebook 自定义受众:
var url = $"{advertiserId}/customaudiences?limit={limit}&fields=name"
+ "&filtering=[{'field':'subtype','operator':'EQUAL', 'value':'CUSTOM'}]";
以上调用有效并且 returns 用户自定义受众。但是,我需要通过 data_source.type 和数据-source.subtype 额外过滤自定义受众,即
filtering=[...{'field':'data_source.type','operator':'EQUAL', 'value':'FILE_IMPORTED'}]";
我已经通读了文档,但看不出哪里出错了。
我得到一个
Invalid parameter
尝试按 data_source.type
过滤时出错
这是我看过的文档:
https://developers.facebook.com/docs/marketing-api/reference/ad-account/customaudiences/
https://developers.facebook.com/docs/marketing-api/reference/custom-audience/#parameters-2
我设法通过将 data_souce 添加到我的请求 URL 并使用我创建并存储在配置中的列表对 data_source 进行过滤来解决此问题:
public FacebookEntitiesResult<FacebookAudience> GetFacebookAudiences(string advertiserId, string token, int? limit, PagingCursors cursors)
{
if (!limit.HasValue)
limit = ConfigValues.FacebookGraphResultLimit;
var url = $"{advertiserId}/customaudiences?limit={limit}&fields=name,data_source"
+ "&filtering=[{'field':'subtype','operator':'EQUAL', 'value':'CUSTOM'}]";
var customAudienceTypes = Instance.Of<IConfigHelper>().GetStringArrayOfAppSettings(ConfigKeys.Extensions.FacebookAudienceUnsupportedTypeArray, ",");
var customAudiences = GetResult<FacebookEntitiesResult<FacebookAudience>>(url, token, cursors);
customAudiences.Data = customAudiences.Data.Where(a => !customAudienceTypes.Contains(a.Data_Source.Type)).ToArray();
return customAudiences;
}
配置:
<key name="FacebookAudienceUnsupportedTypeArray" defaultValue="THIRD_PARTY_IMPORTED"></key>
我正在尝试过滤我们通过此端点获得的 Facebook 自定义受众:
var url = $"{advertiserId}/customaudiences?limit={limit}&fields=name"
+ "&filtering=[{'field':'subtype','operator':'EQUAL', 'value':'CUSTOM'}]";
以上调用有效并且 returns 用户自定义受众。但是,我需要通过 data_source.type 和数据-source.subtype 额外过滤自定义受众,即
filtering=[...{'field':'data_source.type','operator':'EQUAL', 'value':'FILE_IMPORTED'}]";
我已经通读了文档,但看不出哪里出错了。
我得到一个
Invalid parameter
尝试按 data_source.type
过滤时出错这是我看过的文档:
https://developers.facebook.com/docs/marketing-api/reference/ad-account/customaudiences/
https://developers.facebook.com/docs/marketing-api/reference/custom-audience/#parameters-2
我设法通过将 data_souce 添加到我的请求 URL 并使用我创建并存储在配置中的列表对 data_source 进行过滤来解决此问题:
public FacebookEntitiesResult<FacebookAudience> GetFacebookAudiences(string advertiserId, string token, int? limit, PagingCursors cursors)
{
if (!limit.HasValue)
limit = ConfigValues.FacebookGraphResultLimit;
var url = $"{advertiserId}/customaudiences?limit={limit}&fields=name,data_source"
+ "&filtering=[{'field':'subtype','operator':'EQUAL', 'value':'CUSTOM'}]";
var customAudienceTypes = Instance.Of<IConfigHelper>().GetStringArrayOfAppSettings(ConfigKeys.Extensions.FacebookAudienceUnsupportedTypeArray, ",");
var customAudiences = GetResult<FacebookEntitiesResult<FacebookAudience>>(url, token, cursors);
customAudiences.Data = customAudiences.Data.Where(a => !customAudienceTypes.Contains(a.Data_Source.Type)).ToArray();
return customAudiences;
}
配置:
<key name="FacebookAudienceUnsupportedTypeArray" defaultValue="THIRD_PARTY_IMPORTED"></key>