通过api添加带有child_attachments的Facebook帖子时出现“无法使用URL”错误

时间:2019-02-13 17:38:59

标签: php facebook

trying正在使用api和child_attachments参数在api上在Facebook上发帖,因此我可以在1个帖子中传递多个网址。 在facebook调试器中,我像这样传递json

{
  "message": "test debug",
  "child_attachments": [
    {
      "link": {
        "link": "https://google.com"
      }
    },
    {
      "link": {
        "link": "https://ft.com"
      }
    }
  ]
}

但是我收到以下错误消息

 { "error": {
    "message": "Invalid parameter",
    "type": "OAuthException",
    "code": 100,
    "error_data": {
      "blame_field_specs": [
        [
          "child_attachments[0][link]"
        ]
      ]
    },
    "error_subcode": 2061006,
    "is_transient": false,
    "error_user_title": "URL Can't Be Used",
    "error_user_msg": "The URL you entered, \"https://google.com\" doesn't direct to a website. Please enter a valid URL and try again.",
    "fbtrace_id": "xxxxxxxx"
  }
}

我尝试在应用程序域中设置网址,我尝试使用带/不带https和/不带www的URL。

还是没有运气,有人可以给我一些建议吗?

谢谢, 罗马。

1 个答案:

答案 0 :(得分:0)

好的,所以我想,正确的格式应该是这样的:

{
  "message": "message to post",
  "link": "https://yahoo.com",
  "child_attachments": [
    {
      "link": "https://yahoo.com",
      "name": "name -1",
      "picture": "https://images.all-free-download.com/images/graphiclarge/ethereal_image_185195.jpg"
    },
    {
      "link": "https://google.com",
      "name": "name - 2 ",
      "picture": "https://images.all-free-download.com/images/graphiclarge/ethereal_image_185195.jpg"
    }
  ]
}

请注意,即使您在child_attachments中添加了链接,您也必须为post提供'link'参数