[POST] .../v1/ticket/setrating
Sets a rating for a closed CRM ticket. Use this method to store the customer's service rating after a CRM ticket has been closed and the channel allows ratings. The method validates the closed ticket, channel rating settings, 1.5 rating range and one-time rating rule, saves rating and optional comment only when no rating exists yet, writes an action log record, sends TicketRatingSet webhook and returns row_affected with the ticket id. The request body is required; id must be positive, rating must be from 1 to 5 and rating cannot be changed after it has already been set. The caller must have CRM ticket edit/rating-set permission; missing body, invalid id or rating, missing ticket, non-closed ticket status, disabled channel rating, already-set rating, database errors, transaction failures and action-log errors are returned as HTTP 200 ErrorResult business errors.
Request Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| id | Int64 | Required | Ticket ID. |
| rating | Int32 | Required | Rating in the 1.5 range. |
| rating_comment | String | Optional | Rating comment. |
Request Example
{
"id": 610,
"rating": 5,
"rating_comment": "Fast and helpful reply"
}
Response Parameters
| Name | Type | Description |
|---|---|---|
| ok | Boolean | Indicates whether the request completed successfully. |
| result | Update | Update operation result. |
Response Example
{
"ok": true,
"result": {
"row_affected": 1,
"ids": [
610
]
}
}