2

Hi I'am new to facebook marketing API. I want to download account complete report in csv format for which I am using Insights API Asynchronous Jobs , Using which I am able to get "report_run_id" and after that I made api request for this link .Its giving wrong response. Can anybody help me how can download report in csv format.code which i tried is:

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
  • You found a solution on how to do it with the API? Commented Mar 6, 2019 at 21:05

1 Answer 1

4

I'll give examples using curl, but you should be able to translate these to javascript easily.

Using the report_run_id, you can query the completeness of the async query, for example:

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

This should eventually give you a completion of 100%:

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

You then need to query the report_run_id for with the insights edge:

curl -G \
  -d 'access_token=<ACCESS_TOKEN>' \
  https://graph.facebook.com/v2.10/<YOUR_REPORT_RUN_ID>/insights
Sign up to request clarification or add additional context in comments.

3 Comments

Great, Worked for me!
Is there any way to get a CSV export via the API?
hi guys, where to find the access token ? I am struggling to find the access token here.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.