Comments API

Create, save or delete comments and discussion threads that are used alongside videos and drawings.

Creating comments

Comments can be submitted as standalone text or as part of a discussion thread. They can be tied to a particular user and/or a canvas drawing if desired. Or they can exist as anonymous comments without any associated drawings or thread. If created as part of a discussion thread, a parent_id and discussion_id is required. The parent_id identifes the comment that a new comment is replying to.

There are only two required parameters when submitting comments: 'video_id' which identifies the video the comment is about, and 'body' which is the comment itself. If a parent_id is supplied, the comment automatically becomes part of a discussion thread.

Required parameters:

  • body (text) - The comment text itself. Required
  • video_id (string) - ID of the associated video. Required
Optional parameters:
  • video_playback_position (float) - Time location on video that the comment should be placed
  • discussion_id (integer) - If the comment is part of a threaded discussion, this identifies it
  • user_name (string) - User name (can be blank)
  • user_id (integer) - User id, if any
  • user_image (string) - User profile image, if any
  • parent_id (integer) - Identifies the parent if comment is part of a threaded discussion
  • canvas_id (integer) - Canvas/drawing tied to the comment, if any

Deleting comments

You can permanently remove comments by submitting a REST http delete request with the following parameters:

  • video_id (integer) - Identifies the video that a comment is tied to
  • id (integer) - This is the id of the comment to be deleted
  • user_id (integer) - The id of the user who created the comment

The three parameters are required and VidPrep will check that they match (the comment id matches the video id and user id). The comment won't be deleted if they don't match or if the authentication id doesn't match as owner of the video (obviously!).

Upon a successful delete, three values are returned: @items, @canvases and @captions. These allow for reloading the associated items to a video after deletion of a comment. The values can be returned as ruby variables or JSON data.

Editing comments

Not yet supported, but may be in the future.