Posting/retrieving photo-comments using Graph API
Asked Answered
H

3

13

When I use the Graph API to fetch a comment containing an image, the returned JSON contains no reference to it, e.g.

{
  "id": "10151452996201039_9302037", 
  "from": {
    "name": "Anton Raxacoricofallapatorius Dyudin", 
    "id": "1534947411"
  }, 
  "message": "", 
  "can_remove": true, 
  "created_time": "2013-06-20T06:47:41+0000", 
  "like_count": 0, 
  "user_likes": false
}

I am likewise lost as to what POST field can be used to embed a picture when commenting. How can I achieve either of the above?

Huonghupeh answered 21/6, 2013 at 8:37 Comment(1)
I also want to post photo comments through FB API but am lost. I don't think there's any way yet in the API to get or post them.Materialism
O
10

Add fields=attachment to your query.

https://developers.facebook.com/docs/graph-api/reference/comment

Opalina answered 22/7, 2013 at 17:43 Comment(5)
This would appear to be the case, however the API explorer grays out the choice with no explanation, and attempting the URL directly yields an "Unsupported get request" exception.Huonghupeh
Graph api response does not seem to give the attachment field. Also the FQL query gives null for the field attachment. Any luck @Anton?Microanalysis
I have observed the same phenomenon: the field is null both through the FQL and the graph API, as well as in the graph explorer. Any idea anyone ?Guenther
Worked for me, too. Should be the accepted answer for anyone looking to get attachment data with their graph request.Directly
I'm trying to get the feed comments. How to mention field parameter in me/feed api?Ernesternesta
U
3

It actually works when you use fields=attachment

https://graph.facebook.com/POSTID_COMMENTID?fields=attachment&access_token=ACCESS_TOKEN
Unific answered 13/1, 2014 at 21:26 Comment(0)
M
1

If you want a more extensive query that return everythings and I mean everything including user id's, profile image (large version), comment related info as well and attachement info use this.

&fields=id,status_type,created_time,from{name,id,picture.width(400).height(400)},message,picture.width(400).height(400),link,icon,comments{comments{attachment,from{picture.width(400).height(400),name},id,message,created_time},from{picture.width(400).height(400),name},id,message,attachment,created_time}
Messina answered 27/6, 2017 at 4:6 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.