您好我是facebook marketing API的新手。我想以csv格式下载帐户完整报告,我正在使用Insights API异步作业,使用我可以获得" report_run_id"之后我向this link提出了api请求。它给出了错误的回复。任何人都可以帮助我如何在csv format.code下载报告,我试过:
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();
}
答案 0 :(得分: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