是否可以通过FB Group API将图像上传到我自己的Facebook群组?

huangapple go评论69阅读模式
英文:

Is it possible to upload an image to my own Facebook group via FB Group API?

问题

我有一个我管理的Facebook群组,我想要使用Facebook群组API从我的服务器自动发布一些图片,目前我使用POST https://graph.facebook.com/v17.0/{group-id}/feed端点来上传文本和链接到群组,但我想要能够发布一张图片(最好是多张图片),但我不明白是否可能,似乎Meta API文档指向了群组照片API,但不清楚如何使用它,我找不到应该提供图像URL/base64的body参数在哪里,只有aid(相册ID),它已被弃用。

我所尝试实现的是否可能?我该如何做?

英文:

I have a Facebook group that I manage and I want to use the Facebook groups API to post some images automatically from my server, at the moment I use the POST https://graph.facebook.com/v17.0/{group-id}/feed endpoint to upload text and links to the group but I want to be able to publish an image as well (multiple images would be best), but I don't understand if it's possible or not, it seems like Meta API docs point to the group photos API but it is not clear how to use it I can't find the body param where I should provide the image URL/base64 to, there's only aid (album id) which is deprecated.

Is what I'm trying to achieve possible? How can I do it?

答案1

得分: 1

您可以使用 url Group Photos API 的 Param 参数来指定图像文件。

示例请求:-

curl -i -X POST \
 "https://graph.facebook.com/v17.0/222863893908133/photos?url=https%3A%2F%2Fimg.freepik.com%2Ffree-photo%2Fwide-angle-shot-single-tree-growing-clouded-sky-during-sunset-surrounded-by-grass_181624-22807.jpg&access_token=EAAOPZAhS8Nx4BAHP4gGZXXX"

响应:-

{
  "id": "571144611858970",
  "post_id": "222863893908133_222867323907790"
}

希望这有所帮助。

英文:

You can use url Param of Group Photos API to specify the image file.

Example request:-

curl -i -X POST \
 "https://graph.facebook.com/v17.0/222863893908133/photos?url=https%3A%2F%2Fimg.freepik.com%2Ffree-photo%2Fwide-angle-shot-single-tree-growing-clouded-sky-during-sunset-surrounded-by-grass_181624-22807.jpg&access_token=EAAOPZAhS8Nx4BAHP4gGZXXX"

Response:-

{
  "id": "571144611858970",
  "post_id": "222863893908133_222867323907790"
}

I hope this helps.

huangapple
  • 本文由 发表于 2023年6月22日 19:05:38
  • 转载请务必保留本文链接:https://go.coder-hub.com/76531248.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定