# Comments
Manage ticket comments. Available to all user roles, however user user can see comments for the tickets that they have access to.
# Comment Object
| Name | Type | Comment |
|---|---|---|
| id | integer | The comment unique identifier. |
| body | string | Comment text. |
| preview | string | The comment preview text. |
| type | integer | Comment type. |
| private | boolean | true if comment is private, false otherwise. |
| created_at | datetime | Comment creation timestamp. |
| updated_at | datetime | Comment update timestamp. |
The type attribute can take one of the following values:
| Status | Value |
|---|---|
| Reply | 1 |
| Note | 2 |
# Paginate Comments
GET
/tickets/{ticket_id}/comments# Request
curl --location --request GET 'https://yoursubdomain.support-hub.io/api/tickets/{ticket_id}/comments' \
--header 'Accept: aplication/json'# Example Response
{
"data": [
{
"id": 295,
"body": "Random comment body...",
"preview": "Random comment body...",
"type": 1,
"created_at": "2019-09-19 09:06:51",
"updated_at": "2019-09-19 09:06:51",
},
//...
],
"links": {
//...
},
"meta": {
//...
}
}
# Available includes
If provided, the available includes will be part of the response for each ticket object.
userA user who created the comment.
attachmentsAn array of attachment objects.
ticketA ticket to which a comment belongs to.
# Sortable Fields
created_at
# View a Comment
GET
/comments/{id}# Example Request
curl --location --request GET 'https://yoursubdomain.support-hub.io/api/comments/{id}' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json'# Example Response
{
"data": {
"id": 295,
"body": "Random comment body...",
"preview": "Random comment body...",
"type": 1,
"created_at": "2019-09-19 09:06:51",
"updated_at": "2019-09-19 09:06:51"
}
}
# Available includes
Same as for when paginating the comments.
# Create a Comment
POST
/tickets/{ticket_id}/comments# Parameters
| Parameter | Type | Required | Validation |
|---|---|---|---|
| body | string | Yes | Any string/HTML. |
| type | enum | Yes | Valid comment type identifier. 1 for Reply and 2 for Note. |
| private | boolean | Yes | true if comment should be private, false otherwise. |
| close | boolean | No | true if ticket should be closed, false otherwise. It is only taken into consideration if a ticket is not already closed. |
| attachments | array | No | A list of attachment ids to be associated with a comment. |
# Headers
| Accept | application/json |
| Content-Type | application/json |
# Example Request
curl --location --request POST 'https://yoursubdomain.support-hub.io/api/tickets/{ticket_id}/comments' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--data-raw '{
"body": "Random comment body...",
"type": 1,
"private": true
}'# Example Response
Status: 201 Created
{
"data": {
"id": 295,
"body": "Random comment body...",
"preview": "Random comment body...",
"type": 1,
"type_text": "Reply",
"created_at": "2019-09-19 09:06:51",
"updated_at": "2019-09-19 09:06:51",
}
}
# Update a Comment
PATCH
/comments/{id}# Parameters
| Parameter | Type | Required | Validation |
|---|---|---|---|
| body | string | Yes | Any string/HTML. |
# Headers
| Accept | application/json |
| Content-Type | application/json |
# Example Request
curl --location --request PATCH 'https://yoursubdomain.support-hub.io/api/comments/{id}' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--data-raw '{
"body": "Updated body"
}'# Example Response
Status: 200 OK
{
"data": {
"id": 295,
"body": "updated body",
"preview": "updated body",
"type": 1,
"type_text": "Reply",
"created_at": "2019-09-19 09:06:51",
"updated_at": "2019-09-20 10:00:51",
}
}
# Delete a Comment
DELETE
/comments/{id}# Headers
| Accept | application/json |
| Content-Type | application/json |
# Example Request
curl --location --request DELETE 'https://yoursubdomain.support-hub.io/api/comments/{id}' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json'# Example Response
Status: 200 OK
{
"success": true
}
# Make Public
PUT
/comments/{id}/privacy# Headers
| Accept | application/json |
| Content-Type | application/json |
# Example Request
curl --location --request PUT 'https://yoursubdomain.support-hub.io/api/comments/{id}/privacy' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json'# Example Response
Status: 200 OK
{
"success": true
}
# Make Private
DELETE
/comments/{id}/privacy# Headers
| Accept | application/json |
| Content-Type | application/json |
# Example Request
curl --location --request DELETE 'https://yoursubdomain.support-hub.io/api/comments/{id}/privacy' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json'# Example Response
Status: 200 OK
{
"success": true
}
← Tickets Notifications →