Skip to content

Update agent group

Updates Agent Group data in Liner.


URL and method

POST /v2/agent-group/update/{id}/

id int
Agent group identifier in Liner. Value > 0.


Parameters (Body)

Send only the fields you want to update.

names object optional
Object containing agent group names in different languages.

names.ru string optional
Agent group name in Russian.

names.gb string optional
Agent group name in English.

agentIds array<int> optional
Array containing identifiers of agents assigned to the group.


Request example

curl -X POST "https://YOUR_LINER_API_HOST/v2/agent-group/update/{id}/" \
  -H "Content-Type: application/json" \
  -H "X-Api-Key: YOUR_API_TOKEN" \
  -d '{
    "names": {
      "ru": "{{nameRu}}",
      "gb": "{{nameGb}}"
    },
    "agentIds": [{{agentId}}, ...]
  }'
<?php

$host = 'https://YOUR_LINER_API_HOST';
$token = 'YOUR_API_TOKEN';
$id = (int)$id;

// Important: fill in only the fields you want to update
$payload = [
    'names' => isset($names) ? $names : null,
    'agentIds' => isset($agentIds) ? $agentIds : null,
];

// Remove null fields to avoid accidentally overwriting values
$payload = array_filter($payload, fn($v) => $v !== null);

$ch = curl_init($host . '/v2/agent-group/update/' . $id . '/');
curl_setopt_array($ch, [
    CURLOPT_POST => true,
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER => [
        'Content-Type: application/json',
        'X-Api-Key: ' . $token,
    ],
    CURLOPT_POSTFIELDS => json_encode($payload, JSON_UNESCAPED_UNICODE),
    CURLOPT_TIMEOUT => 15,
]);

$response = curl_exec($ch);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);

if ($response === false) {
    throw new RuntimeException('cURL error: ' . curl_error($ch));
}

curl_close($ch);

echo "HTTP {$httpCode}\n";
echo $response;
const host = "https://YOUR_LINER_API_HOST";
const token = "YOUR_API_TOKEN";
const id = Number(id);

// Important: add only the fields you want to update
const payload = {
  names: names ?? undefined,
  agentIds: agentIds ?? undefined,
};

// Remove undefined fields
Object.keys(payload).forEach((k) => payload[k] === undefined && delete payload[k]);

const res = await fetch(`${host}/v2/agent-group/update/${id}/`, {
  method: "POST",
  headers: {
    "Content-Type": "application/json",
    "X-Api-Key": token
  },
  body: JSON.stringify(payload)
});

const data = await res.json();
console.log("HTTP", res.status, data);

Response example

{
  "success": true,
  "message": "",
  "data": []
}

Note

The structure of the data field is described above. For the general API response format, see Request schema