0

안녕 페이스 북 마케팅 API에 새로 온다. Insights API 비동기 작업을 사용하고있는 CSV 형식의 계정 전체 보고서를 다운로드하고 싶습니다. 사용하는 방법은 'report_run_id'를 가져올 수 있으며, 이후에는 this link에 대한 api 요청을했습니다. 응답이 잘못되었습니다. 누군가가 내가 시도를 CSV format.code에서 보고서를 다운로드 할 수있는 방법 좀 도와 줄래 것은 : 나는 컬을 사용하여 예제를 줄 것이다,하지만 당신은 쉽게 자바 스크립트로 이러한 번역 할 수 있어야한다Insights API 비동기 작업을 사용하여 Facebook 보고서를 다운로드하는 방법?

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(); 
} 

답변

1

.

report_run_id를 사용하면 예를 들어, 비동기 쿼리의 완전성을 조회 할 수 있습니다

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

당신은 다음을 수행해야합니다

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

이것은 결국 100 %의 완료를 제공해야 통찰력을 지닌 edge와 함께 report_run_id를 쿼리하십시오 :

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