Facebook API 'Invalid rule JSON format' 创建自定义网络受众时
Facebook API 'Invalid rule JSON format' When Creating Custom Web Audience
我正在使用 Graph API 12.0 创建自定义网络受众并收到“无效规则 JSON 格式”错误。我相信我使用的是指定的格式 here
以下是我的要求:
{
"name": "test",
"rule": {
"inclusions": {
"operator": "or",
"rules": [
{
"event_sources": [
{
"type": "pixel",
"id": PIXEL_ID
}
],
"retention_seconds": 600
}
]
}
},
"retention_days": "1",
"prefill": "1"
}
事实证明,“filter”是必填字段,尽管它在文档中被声明为可选。我认为这是 Facebook API 中的一个错误。如果我不需要任何过滤器怎么办?
以下请求成功:
{
"name": "test",
"rule": {
"inclusions": {
"operator": "or",
"rules": [
{
"event_sources": [
{
"type": "pixel",
"id": PIXEL_ID
}
],
"retention_seconds": 600,
"filter": {
"operator": "and",
"filters": [{
"field": "url",
"operator": "regex_match",
"value": "."
}]
}
}
]
}
},
"retention_days": "1",
"prefill": "1"
}
我正在使用 Graph API 12.0 创建自定义网络受众并收到“无效规则 JSON 格式”错误。我相信我使用的是指定的格式 here
以下是我的要求:
{
"name": "test",
"rule": {
"inclusions": {
"operator": "or",
"rules": [
{
"event_sources": [
{
"type": "pixel",
"id": PIXEL_ID
}
],
"retention_seconds": 600
}
]
}
},
"retention_days": "1",
"prefill": "1"
}
事实证明,“filter”是必填字段,尽管它在文档中被声明为可选。我认为这是 Facebook API 中的一个错误。如果我不需要任何过滤器怎么办?
以下请求成功:
{
"name": "test",
"rule": {
"inclusions": {
"operator": "or",
"rules": [
{
"event_sources": [
{
"type": "pixel",
"id": PIXEL_ID
}
],
"retention_seconds": 600,
"filter": {
"operator": "and",
"filters": [{
"field": "url",
"operator": "regex_match",
"value": "."
}]
}
}
]
}
},
"retention_days": "1",
"prefill": "1"
}