Facebook Developers
DocsToolsSupportNewsApps
Log In
  • Social Plugins
  • Facebook Login
  • Open Graph
  • Facebook APIs
    • Graph API
    • FQL
    • Open Graph
    • Dialogs
    • Chat
    • Internationalization
    • Ads
  • Games
  • Media
  • Payments
  • App Center
  • Promote Your App
  • iOS
  • Android
  • Web
  • Technology Partners
  • Tables
    • album
    • app_role
    • application
    • apprequest
    • checkin
    • comment
    • comments_info
    • connection
    • cookies
    • column
    • developer
    • domain
    • domain_admin
    • event
    • event_member
    • family
    • friend
    • friendlist
    • friendlist_member
    • friend_request
    • group
    • group_member
    • insights
    • like
    • link
    • link_image_src
    • link_stat
    • location_post
    • mailbox_folder
    • message
    • note
    • notification
    • object_url
    • page
    • page_admin
    • page_blocked_user
    • page_global_brand_child
    • page_fan
    • page_milestone
    • permissions
    • permissions_info
    • photo
    • photo_src
    • photo_tag
    • place
    • privacy
    • privacy_setting
    • profile
    • profile_tab
    • profile_view
    • question
    • question_option
    • question_option_votes
    • review
    • score
    • standard_friend_info
    • standard_user_info
    • status
    • stream
    • stream_filter
    • stream_tag
    • subscription
    • table
    • thread
    • translation
    • unified_message
    • unified_message_count
    • unified_message_sync
    • unified_thread
    • unified_thread_action
    • unified_thread_count
    • unified_thread_sync
    • url_like
    • user
    • video
    • video_tag

comment

API Reference › FQL › comment

Description

Comments associated with one or more fb:comments as represented in FQL.

Columns

NameDescription

app_id

id

The application id associated with this comment

can_comment

bool

If the current user is able to post a comment reply

can_like

bool

If the current user is able to like this comment

can_remove

bool

If the current user is able to remove this comment

comment_count

unsigned int32

The number of replies to this comment

fromid

id

The user submitting a comment

id

string

A unique ID for a given XID for each comment

is_private

bool

If this comment is private

likes

unsigned int32

The number of likes for this comment

object_id

id

The object_id of an object on Facebook. This can be a video, note, link, photo, or photo album. Note that for photos and albums, the object_id must be queried from the photo and album FQL tables. Note that in the photo and album tables, object_id is a different field from pid and aid. You must specify either an xid or an object_id

object_id_cursor

string

The next page of results for this object

parent_id

string

The ID of the parent comment to this reply or 0 (zero) if this is a top-level comment

parent_id_cursor

string

The cursor of the parent_id field

post_fbid

numeric string

The object_id of this comment. This can be used for querying likes for this comment or replies to this comment if the comment came from the comments plugin

post_id

string

The ID of the post in the stream

post_id_cursor

string

The next page of results for this post

text

string

The text of a comment

text_tags

array

Array of mention objects for each object tagged in the comment

time

timestamp

A UNIX timestamp associated with the creation time of a comment

user_likes

bool

If the current user liked this comment

Examples

  • SELECT ... FROM comment WHERE id = A
  • SELECT ... FROM comment WHERE object_id = A
  • SELECT ... FROM comment WHERE parent_id = A
  • SELECT ... FROM comment WHERE post_id = A
Note: Additional filters on other columns can be specified but they may make the query less efficient.

Permissions

To read the comment table you need

  • no access_token for public data
  • any valid access_token to access private field: user_likes

Notes

Comments Order

Some comment threads, for example those from the Comments Plugin, are sorted by social relevance and not by time. Since there is no social_relevance column to ORDER BY, in order to get comments in socially relevant order, please add "AND parent_id='0'" to the WHERE clause of your query and omit any ORDER BY. For example:

SELECT id, text, time, fromid FROM comment WHERE object_id='10151309718465667' AND parent_id='0'

Will get the top level comments on this photo in the order they appear on the site. If you would like to get the comments in chronological order, simply add ORDER BY time:

SELECT id, text, time, fromid FROM comment WHERE object_id='10151309718465667' AND parent_id='0' ORDER BY time

To find out the default display order, select the comment_info column of the appropriate table. For the above example that would be:

SELECT comment_info FROM photo WHERE object_id='10151309718465667'

This will return a comment_info object with the comment_order:

{
  "comment_info": {
    "can_comment": true,
    "comment_count": 19,
    "comment_order": "ranked"
  }
}
Facebook © 2013 · English (US)
AboutAdvertisingCareersPlatform PoliciesPrivacy Policy