php - 通过 api 添加带有 child_attachments 的 Facebook 帖子时出现“无法使用 URL”错误
问题描述
我要trying
使用 api 和 child_attachments 参数在 facebook 上发帖,所以我可以在 1 个帖子中传递多个 url。在 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"
}
}
我尝试在应用程序域中设置 url,我尝试使用带/不带 https 和带/不带 www 的 url。
仍然没有运气,有人可以给我一些建议吗?
谢谢,罗曼。
解决方案
好的,所以我想,正确的格式应该是这样的:
{
"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 提供“链接”参数
推荐阅读
- scala - 如何在 scala/cats 中为 State[S, A] 实现 Applicative
- bad-request - Mule#4:RAML 无法解析转义字符中的 JSON
- java - Resilience4j 异常处理
- sql - 将每一行与另一列的对应行相加
- apexcharts - 在热图顶点图中,我们如何删除重复的 x 轴标签?
- sqlite - 如何使用带有颤振的地板从资产中预填充数据库?
- amazon-web-services - Cloudformation !Ref 没有为 vpc 端点返回正确的值
- python - Python/Selenium 通过抓取网页以在 Google 表格上创建表格输出嵌套列表
- javascript - 面临 SQLite3 问题
- python-3.x - 数据以 3 位小数四舍五入