【发布时间】:2019-11-01 11:50:16
【问题描述】:
我在 Facebook Graph API Explorer 成功 上运行了一个查询,但是当我使用 UrlFetchApp 在 Google Apps 脚本上运行相同的查询时,我得到一个错误 - 无效参数。查询是这样的:
https://graph.facebook.com/v4.0/act_1015703131******/insights?fields=spend&level=account&date_preset=yesterday&filtering=[{field:campaign.name,operator:CONTAIN,value:perf },{field:adset.name,operator:NOT_CONTAIN,value:rmk}]&access_token=********
当我运行相同的查询没有过滤时,它会按预期工作!
编辑: 我尝试对过滤参数进行编码,但它引发了一个新错误:
Request failed for https://graph.facebook.com returned code 400. Truncated server response: {"error":{"message":"(#100) param filtering must be an array.","type":"OAuthException","code":100,"fbtrace_id":"AMw2vkaHXbuiVSQuSNg28yZ"}} (use muteHttpExceptions option to examine full response)
由于错误没有给出任何具体描述,究竟是什么导致了问题?
【问题讨论】:
-
请与我们分享您的 UrlFetchApp 请求。
-
这是 UrlFetchApp 和我在我的问题上分享的 url,当然没有星号。
-
我已经看到了,但仍然无法解决我的问题。
-
在没有过滤器的情况下调用它,查看返回的 JSON 对象并从那里开始工作
标签: javascript facebook-graph-api google-apps-script urlfetch