我正在浏览Facebook Marketing Api docs
例如考虑此文档
curl \
-F 'name=LifetimeBudgetSet' \
-F 'lifetime_budget=100000' \
-F 'optimization_goal=POST_ENGAGEMENT' \
-F 'billing_event=IMPRESSIONS' \
-F 'bid_amount=1500' \
-F 'targeting={"geo_locations":{"countries":["US"]}}' \
-F 'campaign_id=<CAMPAIGN_ID>' \
-F 'end_time=2017-09-21T15:41:30+0000' \
-F 'status=PAUSED' \
-F 'access_token=<ACCESS_TOKEN>' \
https://graph.facebook.com/VERSION/act_<AD_ACCOUNT_ID>/adsets
在这里他们有要求
-F 'access_token=<ACCESS_TOKEN>' \
通常,我们在标头中传递访问令牌,但在市场营销api文档中,该令牌写为-F 'access_token=<ACCESS_TOKEN>' \
,所以我应该这样做吗?
await axios({
method: "post",
url: "https://graph.facebook.com/v3.2/" + accountId + "/adsets",
headers: {
Authorization: "Bearer " + accessToken
},
data: {
name: name,
optimization_goal: optimization_goal,
billing_event: billing_event,
lifetime_budget: lifetime_budget,
daily_budget: daily_budget,
start_time: start_time,
end_time: end_time,
campaign_id: campaign_id,
targeting: JSON.parse(targeting),
status: status
}
});
或
await axios({
method: "post",
url: "https://graph.facebook.com/v3.2/" + accountId + "/adsets",
data: {
name: name,
optimization_goal: optimization_goal,
billing_event: billing_event,
lifetime_budget: lifetime_budget,
daily_budget: daily_budget,
start_time: start_time,
end_time: end_time,
campaign_id: campaign_id,
targeting: JSON.parse(targeting),
status: status,
access_token: access_token
}
});