Stream.addComment

From Facebook Developer Wiki

Jump to: navigation, search

Contents

Description

This method adds a comment to a post that was already published to a user's Wall.

Privacy rules apply to the posts to which the user can add comments; the user must be able to see the post in order for your application to allow the user add a comment to it.

Desktop applications must pass a valid session key, and only the user associated with that session key can add comments. Other applications can allows users to add comments to any posts the user can see, provided you have a valid post_id.

In order for your application to allow a user to add a comment, that user must grant your application the publish_stream extended permission.

Parameters

RequiredNameTypeDescription
optional session_key string The session key of the logged in user. The session key is automatically included by our PHP client. Desktop applications must pass a valid session key (and have been granted the publish_stream extended permission); other applications need only the publish_stream extended permission.
uid string The user ID of the user adding the comment. If this parameter is not specified, then it defaults to the session user. Note: This parameter applies only to Web applications and is required by them only if the session_key is not specified. Facebook ignores this parameter if it is passed by a desktop application.
required post_id string The ID for the post to which you're adding the comment.
comment string The text of the comment. This is a plain text parameter only; you cannot format the comment with HTML or FBML.

Example Requests

$facebook->api_client->stream_addComment(post_id, comment);

Response

This call returns a comment_id if the comment was added successfully, or an error code if the call was unsuccessful.

Error Codes

CodeDescription
100 Invalid parameter.
102 Session key invalid or no longer valid (if it's a desktop application and the session is missing).
200 Permissions error. The application does not have permission to perform this action.
210 User not visible. The user doesn't have permission to act on that object.

Notes

You can call this method using a session secret, and not the application secret (for example, for a Facebook Connect site or desktop application).

See Also

Using the Open Stream API

reference