How to further filter Facebook Graph API query on Graph API Explorer for my ad account?

Viewed 9940

I'm trying to get the ad spend and mobile app installs for my app using the Facebook Graph API v2.11 for marketing. In the Graph API Explorer, when I try

/act_<my account>/campaigns?fields=insights{actions,spend}&time_range={'since':'2017-07-07','until':'2017-12-12'}

In the output, under "insights", I get an object of this type:

    "data": [
      {
        "actions": [             
          {
            "action_type": "comment",
            "value": "3"
          },
          {
            "action_type": "like",
            "value": "33"
          },
          {
            "action_type": "link_click",
            "value": "1531"
          },
          {
            "action_type": "mobile_app_install",
            "value": "1049"
          }
        ],
        "spend": "8621.03",
        "date_start": "2017-10-28",
        "date_stop": "2017-11-26"
      }
    ]

If I want it to fetch only the actions where action type is "mobile_app_install", how can I further filter my query?

2 Answers

There is possible to filter that on Facebook side just call it like that:

/act_<yourAdAccount>/insights
  ?level=campaign
  &fields=actions,spend
  &time_increment=all_days
  &time_range={'since':'2017-07-07','until':'2017-12-12'}
  &filtering=[{field: "action_type",operator:"IN", value: ['mobile_app_install']}]
  &use_account_attribution_setting=true
Related