我的目标是使用 Facebook 的 Batch API 创建一些广告:https ://developers.facebook.com/docs/marketing-api/asyncrequests/v2.9
我在这个 URL 发送一个 POST 请求:
https://graph.facebook.com/v2.9/act_158365238/ads
我根据文档发送 2 个参数:
1- access_token
2-批次
批处理参数中的 JSON如下所示:
{
"method": "POST",
"relative_url": "v2.9\/act_158365238\/ads",
"attached_files": "test1",
"body": "creative={\"title\":\"Test title 1\",\"body\":\"Test body 1\",\"object_url\":\"https:\/\/apps.facebook.com\/testapp\/\", \"image_file\":\"test1.jpg\"}&targeting={\"countries\":[\"US\"]}&name=test1"
}
问题
当我使用 POSTman 或我的 PHP 代码发送此请求时,它会引发以下错误
{
"error": {
"message": "(#100) The parameter creative is required",
"type": "OAuthException",
"code": 100,
"fbtrace_id": "Gj2sG7N8l1f"
}
}
但是,当我通过 Facebook 的 Graph API 工具发送完全相同的请求时,它成功地创建了广告。