Comments

Last updated 28 days ago

Comments are discussions around content and can be added to a folder or file in Onehub. You can create, delete, and list comments. Comments are identified by a unique, random ID.

post
Create a Comment

https://ws-api.onehub.com
/:item/:item_id/comments
Creates a comment on the :item (folder or file) specified via :item_id.
Request
Response
Path Parameters
:item
required
string
The type of item. Can either be folders or files.
:item_id
required
integer
The unique identifier of the item that you would like to create the comment on.
Body Parameters
body
required
string
The text of the comment.
201: Created
Returns the newly created comment object and a 201 if the call succeeds.
{
"comment": {
"id": 9417,
"user_id": 481,
"discussion_id": 468087,
"body": "This is an example comment.",
"updated_at": "2016-01-15T16:24:37-08:00",
"user_name": "Matthew Anderson",
"owner_type": "file",
"owner_id": 849607
}
}
422: Unprocessable Entity
Returns a 422 with an error in the message body it a non-existent id is provided.
//

delete
Delete a Comment

https://ws-api.onehub.com
/:item/:item_id/comments/:id
Deletes the comment specified via :id from the :item (folder or file) specified via :item_id.
Request
Response
Path Parameters
:item
required
string
The type of item. Can either be folders or files.
:item_id
required
integer
The unique identifier of the item you would like to delete the comment from.
:id
required
integer
The unique identifier of the comment you would like to delete.
204: No Content
Returns an empty message body and a 204 if the call succeeds.
‚Äč

get
List all Comments

https://ws-api.onehub.com
/:item/:item_id/comments
Lists all comment for the :item (folder or file) specified via :item_id.
Request
Response
Path Parameters
:item
required
string
The type of item. Can either be folders or files.
:item_id
required
integer
The unique identifier of the item that you would like to list comments from.
200: OK
Returns a paged array of comment objects and a 200 if the call succeeds.
{
"total_entries": 1,
"current_page": 1,
"total_pages": 1,
"per_page": 15,
"items": [
{
"comment": {
"id": 9417,
"user_id": 481,
"discussion_id": 468087,
"body": "This is an example comment.",
"updated_at": "2016-01-15T16:24:37-08:00",
"user_name": "Matthew Anderson",
"owner_type": "file",
"owner_id": 849607
}
}
]
}