创建未连接到网页的链接广告:

时间:2018-06-07 16:01:34

标签: c# .net facebook-graph-api facebook-marketing-api

我正在尝试实施此处所述的创建广告请求:https://developers.facebook.com/docs/marketing-api/reference/ad-creative

curl \
  -F 'name=Sample Creative' \
  -F 'title=my title' \
  -F 'body=my body' \
  -F 'object_url=https://www.link.com' \
  -F 'link_url=https://www.link.com' \
  -F 'image_hash=<IMAGE_HASH>' \
  -F 'access_token=<ACCESS_TOKEN>' \
  https://graph.facebook.com/v2.11/act_<AD_ACCOUNT_ID>/adcreatives

我使用字典传递POST参数

var adParameters = new Dictionary<string, string>

    {
     {"adset_id", $"{adSetId}"},
     {"name", $"{adname}"},
     {"title", $"{title}"},
     {"image_hash", $"{imageHash}"},
     {"object_url", $"{objectUrl}"},
     {"link_url", $"{objectUrl}"},
     {"creative", "{\"creative_id\":6081438180357}"},
     {"status", "PAUSED"},
     {"access_token", _permanentAccessToken}
    };

这会导致以下POST请求 https://graph.facebook.com/v3.0/act_250976071760765/ads?adset_id=6093507260957&name=My+ad&title=test+title&image_hash=89af4c1cdb1c54426c8c7b2ef94d70f7&object_url=http%3A%2F%2Fwww.test.com&link_url=http%3A%2F%2Fwww.test.com&creative=%7B%22creative_id%22%3A6081438180357%7D&status=PAUSED&access_token=

结果我收到以下错误

{"error":{"message":"Unsupported post request.","type":"GraphMethodException","code":100,"fbtrace_id":"Cw77eeIxwb0"}}

看起来这个错误是由广告素材参数引起的,但我找不到如何正确传递此参数。

0 个答案:

没有答案