Comments
Create, update, delete, and query the Comments for a Target. Comments may also be inserted based on a Target or deleted based on Id. To write comments, a custom OAuth app with the pages_manage_engagement permission is required.
テーブル固有の情報
Facebook のComments は、特定の対象に関するコメントです。コメントは常に1つのターゲット(コメント対象の項目)に関連付けられています。ターゲットには、投稿、写真、動画などがあります。このテーブルを使用して、特定のターゲットに対するコメントをリストしたり、ターゲットに関する新しいコメントを挿入することができます。
Note: Facebook API の非推奨仕様により、ユーザープロファイルが定義された、またはデフォルトのターゲットであるComments、Photos、Posts、およびVideos ビューへのクエリは、以下のフィールドのデータを返さなくなりました。
- comments
- message_tags
- reactions
- sharedposts
- story
- story_tags
- to
- via
Select
コメントをクエリする場合は、コメントのTarget またはId のいずれかを指定することができます。例えば、特定の投稿に関するすべてのコメントを取得する場合、SELECT ステートメントは次のようになります。
SELECT * FROM Comments WHERE Target = '15526475270_410830705612736'
ID を指定して特定のコメントを取得することもできます。次に例を示します。
SELECT * FROM Comments WHERE Id = '15526475270_410830705612736_5193593'
Target またはId が指定されていない場合、コメントは現在認証されているユーザーまたはページのフィードの投稿からクエリされます。
複数のクエリを組み合わせて、複数のFacebook エンティティにまたがる投稿からコメントを取得することもできます。次に例を示します。
SELECT * FROM Comments WHERE Target IN (SELECT Id FROM Posts WHERE Target IN (SELECT Id FROM Pages))
全ての投稿のコメントを検索したい場合は、Posts テーブルかWall ビューを検討してください。これらには'CommentsData' および'CommentsCount' カラムが含まれます。'CommentsCount' は、コメントがついた投稿(ターゲット)だけをフィルタリングして選択するようにクエリすることができます。
SELECT * FROM Wall WHERE CommentsCount > 0
Insert
The Target is required for Insert operations. Additionally, one of the following must also be specified: Message, AttachmentId, AttachmentShareUrl, AttachmentUrl, Source
Note that a custom OAuth app with the pages_manage_engagement permission is required for this operation.
A sample Insert is provided below:
INSERT INTO Comments (Target, Message) VALUES ('100194609664082_445376221798618', 'hello')
Update
The Target is required for Update operations. Additionally, one of the following must also be specified: Message, AttachmentId, AttachmentShareUrl, AttachmentUrl
Note that a custom OAuth app with the pages_manage_engagement and pages_read_engagement permissions is required for this operation.
A sample Update is provided below:
UPDATE Comments SET Message = 'new message' WHERE Id = '445376221798618_773440321618637'
Delete
Note that a custom OAuth app with the pages_manage_engagement and pages_read_engagement permissions is required for this operation.
A sample Delete is provided below:
DELETE FROM Comments WHERE Id = '445376221798618_773440321618637'
Columns
| Name | Type | ReadOnly | Description |
| ID [KEY] | String | True |
コメントのID。 |
| Target | String | False |
コメントを取得するターゲットのID。これには、アルバム、チェックイン、リンク、ノート、写真、投稿、近況アップデート、または動画を指定できます。 |
| FromId | String | True |
コメントを行ったユーザーのID。 |
| FromName | String | True |
コメントを行ったユーザーの名前。 |
| FromPicture | String | True |
コメントを行ったユーザーの写真。 |
| Message | String | False |
コメントのテキスト。 |
| MessageTags | String | True |
メッセージに含まれるタグの集計。 |
| Likes | Integer | True |
コメントに対するいいね!の数。 |
| CommentsCount | Integer | True |
このコメントへの返信コメントの数。 |
| LikesData | String | True |
コメントのいいね!情報の集計。 |
| UserLikes | Boolean | True |
認証ユーザーがこのコメントにいいね!したかどうかを示すboolean。 |
| CanRemove | Boolean | True |
コメントを削除できるかどうかを示すboolean。 |
| Attachments | String | True |
投稿の添付ファイルの集計。 |
| CreatedTime | Datetime | True |
コメントが作成された時刻。 |
Pseudo-Columns
SELECT ステートメントのWHERE 句では、疑似カラムフィールドを使用して、データソースから返されるタプルを詳細に制御することができます。 詳細については、WHERE 句のセクションを参照してください。
| Name | Type | Description |
| AttachmentId | String |
An optional ID of a unpublished photo uploaded to Facebook to include as a photo comment. |
| AttachmentShareUrl | String |
The URL of a GIF to include as a animated GIF comment. |
| AttachmentUrl | String |
The URL of an image to include as a photo comment. |
| Source | String |
A photo, encoded as form data, to use as a photo comment. |
| IsHidden | Boolean |
Whether this comment is hidden or visible. |
| offset | String |
Which result to begin returning results from. Used for manual paging of results. |