我多次遇到过类似的问题 以下是成功通话
var createAdset_params = {
method: "post"
}
var url = "https://graph.facebook.com/v2.12/act_"+req.body.ADACCOUNT_ID+"/adsets?access_token="+req.body.access_token +
"&name=My+Reach+Ad+Set"+
"&optimization_goal=REACH"+
"&billing_event=IMPRESSIONS"+
"&bid_amount=2"+
"&daily_budget=1000"+
"&campaign_id="+req.body.CAMPAIGN_ID+
"&targeting=%7B%22geo_locations%22%3A%7B%22countries%22%3A%5B%22US%22%5D%7D%7D"+
"&status=PAUSED"+
"&promoted_object%3A%20%7B"+
"page_id%3A%20%"+req.body.PAGE_ID+"%22%7D";
request({url:url, qs: createAdset_params}, function(err, response, body) {
if(err) {
console.log(err); return;
}
console.log("create adset result", body);
res.send(body);
});
创建广告集并返回adset的ID。
以下不是成功通话。
var createAdset_params = {
method: "post"
name:"My Reach Ad Set",
promoted_object: {page_id: req.body.PAGE_ID},
optimization_goal: "REACH",
billing_event:"IMPRESSIONS",
bid_amount:2,
daily_budget:1000,
campaign_id:req.body.CAMPAIGN_ID,
status: "PAUSED",
targeting:{
geo_locations: {countries:["US"]}
}
}
var url = "https://graph.facebook.com/v2.12/act_"+req.body.ADACCOUNT_ID+"/adsets?access_token="+req.body.access_token;
request({url:url, qs: createAdset_params}, function(err, response, body) {
if(err) {
console.log(err); return;
}
console.log("create adset result", body);
res.send(body);
});
显示管理员权限错误,即使access_token
是管理员access_token
,在第一次通话时成功。
是否有人成功使用以下格式(常规邮政请求格式)?
任何暗示都会非常感激!
答案 0 :(得分:0)
如果您正在查看facebook marketing api doc,要创建广告集,所有参数都会以表单形式发布,而不是查询字符串。
var createAdset_params = {
name:"My Reach Ad Set",
promoted_object: {page_id: req.body.PAGE_ID},
optimization_goal: "REACH",
billing_event:"IMPRESSIONS",
bid_amount:2,
daily_budget:1000,
campaign_id:req.body.CAMPAIGN_ID,
status: "PAUSED",
targeting:{
geo_locations: {countries:["US"]}
},
access_token: req.body.access_token
};
var url = "https://graph.facebook.com/v2.12/act_"+req.body.ADACCOUNT_ID+"/adsets";
request({
url : url,
method: 'POST',
form: createAdset_params
}, function(err, response, body) {
if(err) {
console.log(err); return;
}
console.log("create adset result", body);
res.send(body);
});