【问题标题】:How to download facebook report using Insights API Asynchronous Jobs?如何使用 Insights API 异步作业下载 facebook 报告?
【发布时间】:2018-03-27 23:19:35
【问题描述】:

您好,我是 facebook 营销 API 的新手。我想下载我正在使用 Insights API Asynchronous Jobs 的 csv 格式的帐户完整报告,使用它我可以获得“report_run_id”,然后我对this link 提出了 api 请求。它给出了错误的响应。谁能帮我下载csv格式的报告。我试过的代码是:

OkHttpClient client = new OkHttpClient();    
Request request = new Request.Builder()
  .url("https://www.facebook.com/ads/ads_insights/export_report/?report_run_id=279445242544715&name=reports&format=csv")
  .get()
  .build();

Response response = client.newCall(request).execute();
if(response.isSuccessful()){
 String resposes=response.body().string();
}

【问题讨论】:

  • 您找到了如何使用 API 的解决方案?

标签: facebook-graph-api facebook-ads-api facebook-marketing-api facebook-java-api


【解决方案1】:

我将给出使用 curl 的示例,但您应该能够轻松地将这些示例转换为 javascript。

使用report_run_id,可以查询异步查询的完整性,例如:

curl -G \
  -d 'access_token=<ACCESS_TOKEN>' \
  https://graph.facebook.com/v2.10/1000002

这最终应该会让你完成 100%:

{
  "id": "6044775548468",
  "account_id": "1010035716096012",
  "time_ref": 1459788928,
  "time_completed": 1459788990,
  "async_status": "Job Completed",
  "async_percent_completion": 100
}

然后您需要使用见解边缘查询 report_run_id:

curl -G \
  -d 'access_token=<ACCESS_TOKEN>' \
  https://graph.facebook.com/v2.10/<YOUR_REPORT_RUN_ID>/insights

【讨论】:

  • 太好了,为我工作!
  • 有什么方法可以通过 API 导出 CSV 文件吗?
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多