c# - Can't create Facebook AdSet -
i can't create new ad set, got message. (facebookapiexception - #100) invalid parameter
my code :
dynamic parameters = new expandoobject(); parameters.name = title; parameters.billing_event = "impressions"; parameters.optimization_goal = "post_engagement"; parameters.daily_budget = "2000"; parameters.campaign_group_id = groupis; parameters.targeting = (dynamic)(new expandoobject()); parameters.targeting.age_max = 65; parameters.targeting.age_min = 25; parameters.targeting.geo_locations = (dynamic)(new expandoobject()); parameters.targeting.geo_locations.countries = new list<string>(); parameters.targeting.geo_locations.countries.add("us"); dynamic res = fb.post("/v2.4/act_" + adsid + "/adcampaigns", parameters);
you have add access_token
, this:
var fb = new facebookclient(); dynamic parameters = new expandoobject(); parameters.access_token = access_token; parameters.name = "raedaddset2"; parameters.optimization_goal = "reach"; parameters.billing_event = "impressions"; parameters.campaign_status = "paused"; parameters.bid_amount = "5"; parameters.daily_budget = "2000"; parameters.campaign_group_id = campaign_group_id; parameters.targeting = new expandoobject(); parameters.targeting.age_max = 65; parameters.targeting.age_min = 25; parameters.targeting.geo_locations = new expandoobject(); parameters.targeting.geo_locations.countries = new list<string>(); parameters.targeting.geo_locations.countries.add("jo"); var res = fb.post("/v2.4/act_" + acount_id + "/adcampaigns", parameters);
Comments
Post a Comment