WebTolk Joomla Extensions
90 Extensions
11 Categories
401 Versions released
397250 Downloads
Getting a list of tags for an amoCRM entity
GET /api/v4/{entity_type:leads|contacts|companies|customers}/tags
Official documentation of the method
Name | Type | Description |
---|---|---|
$entity_type |
string |
The type of entity for which tags are requested. Available values
Default value - leads. |
$data |
array |
GET request parameters according to the official documentation of the method.
|
The return value corresponds to the amoCRM documentation for this method.
Example of amoCRM's response to a request for a list of tags for a lead entity:
stdClass Object
(
[_page] => 1
[_links] => stdClass Object
(
[self] => stdClass Object
(
[href] => https://yoursubdomain.amocrm.ru/api/v4/leads/tags/?limit=50&page=1
)
)
[_embedded] => stdClass Object
(
[tags] => Array
(
[0] => stdClass Object
(
[id] => 221687
[name] => тест
[color] =>
)
[1] => stdClass Object
(
[id] => 221689
[name] => тест 2
[color] =>
)
[2] => stdClass Object
(
[id] => 221691
[name] => тест 43
[color] =>
)
)
)
)
The official documentation says about a possible response code 401 The user is not authorized. The WT Amocrm library returns an error object of the following structure:
stdClass Object
(
[error_code] => 404
[error_message] => getTags function: Error while trying to get tag(s) from Amo CRM. Amo CRM API response: <b>title</b>: Not Found
<b>type</b>: https://httpstatus.es/404
<b>status</b>: 404
<b>detail</b>: Cannot GET https://infowebtolkru.amocrm.ru/leadss/tags?limit%5B0%5D=250!
)
use Webtolk\Amocrm\Amocrm;
$limit = 78;
$requset_options = [
'limit' = (((int) $limit > 250) ? 250 : $limit)
];
$amocrm = new Amocrm();
$result_amo_crm = $amocrm->getTags('leads',$requset_options);