Comments
The comments api allows you to create, update, delete and see all comments for different objects. Objects having comments are Clips, Gallery Items and Comments. Note that there can only be two levels of comments, so a comment on a comment cannot be further commented. Additionally it is possible to list all comments on a playlist, which returns the comments of the clips of the playlist.
Attributes | |||
---|---|---|---|
id | Integer | Unique numeric identifier | |
body | String | Text of the comment | |
creator_id | Integer | User id of the user that created the comment. Can be null, when the comment was created by a guest. | |
frame | Integer | Start frame that a comment on a clip refers to. Can be null if the comment does not refer to a specific section. | |
frame_out | Integer | End frame, a comment for clips refers to. Can be null if the comment does not refer to a specific section or refers to a single frame. | |
commentable_type | String | The type of object the comment refers to. Can be Clip, Gallery Item or Comment. | |
commentable_id | Integer | The Id of the object the comment refers to. | |
guest_name | String | If the comment was made by a guest user, guest_name provides the name of the creator. Otherwise it is empty (null). | |
guest_email | String | If the comment was made by a guest user, guest_email provides the email of the creator. Otherwise it is empty (null). | |
comments | Array of Comments | A list of comments on the comment. Empty array for comments on comments. |
Comment URLs depend on the commented object:
Object having Comments | URL |
---|---|
Clip | /api/projects/{project_id}/clips/{clip_id}/comments |
Comment on Clip | /api/projects/{project_id}/clips/{clip_id}/comments/{comment_id}/comments |
Gallery Item | /projects/{project_id}/folders/{folder_id}/galleries/{gallery_id}/items/{item_id}/comments |
Comment on Gallery Item | /projects/{project_id}/folders/{folder_id}/galleries/{gallery_id}/items/{item_id}/comments/{comment_id}/comments |
Playlist | /api/projects/{project_id}/folders/{folder_id}/playlists/{playlist_id}/comments |
To address a single comment in case of updates or deletions, one has to add the comment id as a last parameter (e.g. /api/projects/{project_id}/clips/{clip_id}/comments/{comment_id}).
Actions
{URL} as defined in the list above. |
|||
---|---|---|---|
List all comments for one object | GET | {URL} | |
Create comment for object | POST | {URL} | body: { "comment": { "body": "nice comment" } } |
Update a comment | PUT | {URL}/{comment_id} | body: { "comment": { "body": "updated comment" } } |
Destroy a comment | DELETE | {URL}/{comment_id} |
Possible options (besides body)
Option | Description |
---|---|
frame | Comment on a specific frame |
frame, frame_out | Comment on a range of frames |
Example request
Example (list comments):
GET /api/projects/7/clips/23/comments/42 HTTP/1.1
Curl Example (update comment):
curl -X PUT \ https://webgate.io/api/projects/7/clips/23/comments/42\ -H 'authorization: Bearer example-token' \ -H 'cache-control: no-cache' \ -H 'content-type: application/json' \ -d '{ "comment": { "body": "new comment content", "frame": 13, "frame_out": 17 }'
Successful Response (comment list for a playlist):
HTTP/1.1 200 OK Content-Type: application/json { "status": 200, "status_message": "OK", "info": "", "data": { "array": [ { "id": 9, "body": "nice clip", "creator_id": 2, "frame": 0, "frame_out": null, "commentable_type": "Clip", "commentable_id": 74, "guest_name": null, "guest_email": null, "created_at": "2021-04-27T13:43:59.000Z", "updated_at": "2021-04-27T13:43:59.000Z", "comments": [ { "id": 10, "body": "yes, i agree", "creator_id": 2, "frame": null, "frame_out": null, "commentable_type": "Comment", "commentable_id": 9, "guest_name": null, "guest_email": null, "created_at": "2021-04-27T13:44:29.000Z", "updated_at": "2021-04-27T13:44:29.000Z", "comments": [] } ] }, { "id": 12, "body": "this one is even better", "creator_id": 2, "frame": 0, "frame_out": null, "commentable_type": "Clip", "commentable_id": 75, "guest_name": null, "guest_email": null, "created_at": "2021-04-27T14:55:49.000Z", "updated_at": "2021-04-27T14:55:49.000Z", "comments": [] } ] } }