Add rating to the article
POST https://api.usedesk.ru/support/{account_id}/articles/{id}/change-rating, {account_id} — Knowledge base ID in the system, {id} — Article ID.
Warning. If you use the server version of Usedesk, you will have a different URL of methods. Check the URL for the API with our team — support@usedesk.com.
The method changes the article rating
* — required fields
Parameter
|
Value
|
---|---|
api_token* | Channel API token |
count_positive | Number of positive evaluations to be added |
count_negative |
Number of negative evaluations to be added |
PHP request example
$baseId = 2; $articleId = 96; $data = array( 'api_token'=> 'e1cbe1c1c9d910ef2ae975215644cb53dd555de4', 'count_negative' => 3 'count_positive' => 3 ); $curl = curl_init(); curl_setopt($curl, CURLOPT_URL, 'https://secure.usedesk.com/uapi/support/'. $baseId .'/' . $articleId . '/add-views?' . http_build_query($data)); curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); $result = curl_exec($curl); curl_close($curl); return $result;
Example of a response from server
{ "rating": { "positive": 1, "negative": 123 } }
Description of response parameter:
Parameter | Value |
---|---|
positive |
The total number of positive ratings after the request |
negative | The total number of negative ratings after the request |