Facebook insights API call with breakdown on produ

2019-02-21 01:48发布

i want to make an insights API Call based on a campaign id with a breakdown on product_id:

/{campaign_id}/insights?fields=clicks,ad_id,adset_id,campaign_id,account_id,impressions,cpc,cost_per_inline_link_click,cost_per_inline_post_engagement,cpm,ctr,inline_link_click_ctr&time_range={"since":"2017-07-30","until":"2017-07-30"}&level=ad&breakdowns=product_id&limit=15

if I add another field like inline_link_clicks or frequency i get the following error

{
"error": {
"code": 1,
"message": "Please reduce the amount of data you're asking for, then retry your request"
}
}

I already limited the the Time period on one day so i don't know how to reduce the amount of data furthermore.

If I split up in different Calls to reduce the amount of Data I will fastly get to the API call limitation.

I also tried

/{ad-id}/insights?fields=ad_id&breakdowns=product_id&limit=15&level=ad&date_preset=yesterday

and it still throws me that error...

BUT if I leave "fields" blank i get this JSON:

{
"data": [
{
"date_start": "2017-08-21",
"date_stop": "2017-08-21",
"impressions": "3",
"spend": "0",
"account_id": "{act-id}",
"campaign_id": "{camp-id}",
"adset_id": "{adset-id}",
"ad_id": "{ad-id}",
"product_id": "1234, ABCD«"
}

P.S. I am using Talend Studio with a thttprequest component for making the API call.

Edit: I also tried to use a POST request with /&method=GET and I get the same error there, too.

Edit 24.08.17:

I now tried to reduce the amount of data by using the product_id_limit parameter.

act_XXXX/insights?fields=account_name,ad_id&limit=10&date_preset=yesterday&level=ad&breakdowns=product_id&product_id_limit=1

but still I get the error to reduce the data. In my understanding limiting product_id to 1 i should only get as much data as if i was not using the product_id breakdown?!

1条回答
The star\"
2楼-- · 2019-02-21 02:36

So I resolved this question by myself.

For a huge load of Data from Facebook Insights e.g. with a breakdown on product_id I had to use an Async Request on Facebook:

Instead of a GET Request I made a POST request on my query. In the answer I found a Report ID on which I could make a GET request. Facebook then tells the status of the report. After the completion of the report I queried my first POST request as a GET request on the Report ID and finally got my results.

查看更多
登录 后发表回答