Reputation: 1077
I want to write a JAVA program to create posts including images, for our clients Facebook pages.
using this endpoint https://graph.facebook.com/{{page_id}}/photos
and defining the page_access_token, the text message and URL of the photo I can do it.
In the following example I have created page_access_token
and page_id
in Base Environment.
{ "url":"Path_to_the_photo", "message":"The Desired Text" }
As you can see in this photo, the request to create the post is Successful.
However I want to be able to edit this photo when it is needed, but I cannot find the endpoint in the documentation Developers Facebook.
I noticed that using https://graph.facebook.com/v19.0/{{page_post_id}}
endpoint I can edit the text but not the photo. Does anyone have the idea how I can tackle this?
PS: I have successfully created the application with the full access and the following permissions:
Upvotes: -1
Views: 219
Reputation: 1077
I found the solution. First we need to send a post request to the endpoint:
1-
https://graph.facebook.com/{{page_id}}/photos
{
"published":false,
"url":"Path to your photo"
}
on success reading the id. 2- Then another post request to https://graph.facebook.com/{{page_post_id}}
{
"attached_media":[{"media_fbid":"the id you get from the previous request", "message":"media message"}],
"message":"your probable new message"
}
Upvotes: 0