Facebook insights API call with breakdown on product_id throws error

旧时模样 提交于 2019-12-30 14:08:12

问题


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:


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.



来源:https://stackoverflow.com/questions/45833457/facebook-insights-api-call-with-breakdown-on-product-id-throws-error

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!