2

I need to fetch the most recent comment(persons picture, name and comment) for a given url via the facebook graph api.

I have tried graph.facebook.com/v2.7/{object-id}/comments where I replace {object-id} with my site url, url encoded.

The problem is the graph api thinks that /comments portion is part of the url.

If I do graph.facebook.com/v2.7/?id=myurlhere.com then it at least returns the correct comment count and share count but I have yet to figure out how to request the actual comments.

I have tried using graph.facebook.com/v2.7/{object-id}/comments with the actual object id returned by graph.facebook.com/v2.7/?id=myurlhere.com but of course that doubles the api calls I have to make. I also dont see any image listed along with the comments.

I'm getting closer graph.facebook.com/v2.7/899503886844396/comments?fields=message,from{name,picture}

Now if I can just figure out how to replace that object id with a url.

3

1 Answer 1

3

As mentioned in a comment it's a good idea to use metadata=1 to see what you perhaps will be able to find. That is /?id=yoururlhere&metadata=1 or /yoururlhere?metadata=1

One of the fields is an og_object. Then you have the comments like this /yoururlhere?fields=og_object{comments{message,from{name, picture}}}

(I learned a lesson, I hope, now edited my previos very first answer att stackoverflow.)

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.