试图做
https://developers.facebook.com/docs/marketing-api/buying-api
令牌是沙盒令牌
得到错误:{“错误”:{“消息”:“(#803)您请求的某些别名不存在”
是帐户ID错误
我从:https://www.facebook.com/adsmanager获得了帐户ID。
我甚至尝试了我的Facebook页面ID或来自:https://developers.facebook.com/apps/
不知道还有什么可以尝试的人知道如何处理此错误?
static void Main(string[] args)
{
string test = postrequestAsync().GetAwaiter().GetResult();
Console.WriteLine(test);
}
private static async System.Threading.Tasks.Task<string> postrequestAsync()
{
/*
'name=My campaign' \
-F 'objective=LINK_CLICKS' \
-F 'status=PAUSED' \
-F 'access_token=<ACCESS_TOKEN>' \
https://graph.facebook.com/v3.0/act_<AD_ACCOUNT_ID>/campaigns
*/
try
{
var values = new Dictionary<string, string>
{
{ "name", "My campaign" },
{ "objective", "LINK_CLICKS" },
{ "status", "PAUSED" },
{ "access_token", token }
};
var content = new FormUrlEncodedContent(values);
var response = await client.PostAsync(" https://graph.facebook.com/v3.0/act_<"+accountid+">/campaigns", content);
var responseString = await response.Content.ReadAsStringAsync();
return responseString;
}catch(Exception e)
{
return e.Message;
}
}