Graph API - Photo post insights missing for API-uploaded posts - facebook

The image post below is uploaded using Facebook API endpoint, https://graph.facebook.com/v15.0/{page_id}/photo.
However, it shows "Insights unavailable for this post" instead of "See insights and data as shown below:
Expected Result - Can see insights and data: https://i.stack.imgur.com/GO7aM.png
Actual Result - Can't see insights and data : https://i.stack.imgur.com/a8Fej.png
Here is the code I using to post photo to my page, referring to API documentation here - https://developers.facebook.com/docs/pages/publishing/:
data = {"message": message, "access_token":your_page_access_token, published": True, "url": your_image_url}
response = requests.post(f"https://graph.facebook.com/v15.0/{your_page_id}/photo", data = data)
Not sure why can't see insights and data on this API-uploaded facebook post: https://i.stack.imgur.com/a8Fej.png
Hope for help. Thanks in advance.

Related

How to get Instagram post URL from Facebook Graph media_id

I'm using Instagram Mentions API and was able to obtain FB media_id for couple Instagram posts.
I need media_id to get post content via /user/mentioned_media. Unfortunately that endpoint does not provide ig_id or shortcode or permalink which I need.
Is there a way to get Instagram Post URL with FB Graph API media_id?
It seems like you can get media metadata (and all comments/replies) when someone #-mentions you in a non-owned-media comment by using a query like below.
You would use your own instagram business account id for the first number (the path component), and you'd use the comment_id you received from the webhook comment-mention notification as the second number:
/12345678901234567890?fields=mentioned_comment.comment_id(9876543210987654321){id,text,username,timestamp,media{id,media_type,media_url,permalink,username,like_count,comments_count,comments{id,text,username,user{id,username},like_count,timestamp,replies{id,text,username,user{id,username},like_count,timestamp}}}}
Yes, there is a way you can get Instagram post URL associated with a media if you know the media id.
You can also get more information (all its fields and edges) on media. See the docs here
You can get the Instagram post URL by making a GET request to /{ig-media-id}
Sample Request:
GET https://graph.facebook.com/v15.0/{{media_id}}?fields=permalink, shortcode&access_token={{ACCESS_TOKEN}}
Sample Response:
{
"permalink": "https://www.instagram.com/p/Clxsi5Pol2_/",
"shortcode": "Clxsi5Pol2_",
"id": "17xxx59557977xxx"
}
The value of the permalink is the valid public URL for the post.
You can also use the shortcode returned to construct the URL by concatenating the shortcode to https://www.instagram.com/p/.

How to get data of post on facebook like comments, picture by graph api

I using graph api to post picture to wall of user, after get postid i try to get post data by graph api follow this url:
https://graph.facebook.com/v2.4/postid?access_token=my_access_token
But result return only has message, created_time, id
{
"created_time": "2015-09-10T01:52:18+0000",
"message": "test",
"story": "Minh D\u01b0\u01a1ng added 2 new photos to the album: test_demo_app Photos.",
"id": "507382632760376_508325799332726"
}
So, how to get other data of post such as comments, picture in story, likes ?
Please have a look at the docs first. Since v2.4 you have to specify each field you want to be returned from the Graph API. See
https://developers.facebook.com/docs/apps/changelog#v2_4
https://developers.facebook.com/docs/graph-api/using-graph-api/v2.4#fields
Declarative Fields
To try to improve performance on mobile networks, Nodes and Edges in v2.4 requires that you explicitly request the field(s) you need for your GET requests. For example, GET /v2.4/me/feed no longer includes likes and comments by default, but GET /v2.4/me/feed?fields=comments,likes will return the data. For more details see the docs on how to request specific fields.

Facebook Graph API - Retrieve photo - Unsupported get request

I am testing the Facebook Graph API via their explorer. I managed to get my feed using me/home. However, I want to get some details from uploaded pictures.
As I read on other posts, I have to re-run the query using the object_id in the POST object.
This only works for public images. Whenever I try to do this on a friend's photo, I get:
{
"error": {
"message": "Unsupported get request. Please read the Graph API documentation at https://developers.facebook.com/docs/graph-api",
"type": "GraphMethodException",
"code": 100
}
}
One of them was a photo of my wife. I checked her privacy setting, as far as I can see, she doesn't block 3rd party API's.
How can I get photo details of posts that the API returns in me/home?
I know that it doesn't work for photo's with unique permissions (so e.g. with tags in them), but I tested it with photo's only shared with that person's friends. Tested about 10, none of them work. How is this possible?

Facebook Graph API : get satuses with photos on user's feed

I'm trying to get user's own posts on with images on his feed.
GET https://graph.facebook.com/USER_ID/photos/uploaded
will get me the uploaded images but without the status they were posted on.
on the other hand,
GET https://graph.facebook.com/USER_ID/feed?fields=message
will work just fine , but
GET https://graph.facebook.com/USER_ID/feed?fields=message,attachments
is returning me this
{
"error": {
"type": "http",
"message": "unknown error",
"status": 500
}
}
(FYI as for v2.1 FQL is deprecated)
help?
To my knowledge, you have to do USER_ID/feed and then filter out the posts that aren't images. In those kinds of objects, there is no attachment field. There isn't any way of filtering content in Graph API like you could do in FQL. You would have to get the post type which I'm pretty sure is the field type.

How to Publish a status with multiple photos by Facebook API?

I have a problem with Facebook Graph API. Is there any way to "attach multiple photos within a status post" using the Graph API (Javascript SDK)?
With the iOS Facebook app can post a status with multiple photos.
However, after looking through the documentation on internet I couldn't find out how it works.
Does anyone have idea? This a status screenshot that I would like to generate with the Facebook API.
This could be a solution:
Create a post with just a message, get its ID
Upload all your photos with { "published" : "false" }, get their
IDs
Update each photo with { "target_post" : "<yourPostID>",
"published" : "true" }
Did you see this documentation ? https://developers.facebook.com/docs/opengraph/usergeneratedphotos/
it might help you