/*********************************** ** Выборка вариантов выбора для поля ** Пример: Выборка всех вариантов выбора по полю "Метро" **********************************/ $url='http://yourdomain.intrumnet.com:81/sharedapi/utils/variants'; $params=array( 'property_id'=>485 ); $post = array( 'apikey' =>"4723adc21f8f06d7bd5f848438411161", 'params'=>$params ); $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($post)); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); $result = json_decode(curl_exec($ch)); curl_close ($ch);Пример ответа
stdClass Object
(
[status] => success
[data] => Array
(
[0] => stdClass Object
(
[id] => 4038602
[value] => Алабинская
[bind] => 4035542
[default] => 0
[highlight] =>
[sort] => 0
)
[1] => stdClass Object
(
[id] => 4038603
[value] => Безымянка
[bind] => 4035542
[default] => 0
[highlight] =>
[sort] => 0
)
[2] => ....
)
)
/*********************************** ** Получение списка статей ** Пример: Выборка всех статей, вложенных в категорию Новости **********************************/ $url='http://yourdomain.intrumnet.com:81/sharedapi/publication/list'; $params=array( 'parent_id'=>1 ); $post = array( 'apikey' =>"4723adc21f8f06d7bd5f848438411161", 'params'=>$params ); $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($post)); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); $result = json_decode(curl_exec($ch)); curl_close ($ch);Пример ответа
stdClass Object
(
[status] => success
[data] => stdClass Object
(
[2] => stdClass Object
(
[id] => 2
[id_index] => 2
[gravity] => 0
[description] => Intrum – это новая IT система, помогающая управлению операционной деятельности Вашей компании и бизнес коммуникациям.
[news] => 1
[date_news] => 2013-10-04
[date_timestamp] => 1380834000
[title] => Запуск внутренней системы управления
[publ] => 1
[childs] =>
[cover] => stdClass Object
(
[title] => 23
[url] => /images/article/85.jpg
[preview] => /images/article/85_250x250.jpg
)
)
)
)
/***********************************
** Получение данных в статье
** Пример: Получения контента, размещенной в статье
**********************************/
$url='http://andreytest.intrumnet.com:81/sharedapi/publication/single';
$params=array(
'id'=>7
);
$post = array(
'apikey' =>"4723adc21f8f06d7bd5f848438411161",
'params'=>$params
);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($post));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$result = json_decode(curl_exec($ch));
curl_close ($ch);
Пример ответа
stdClass Object
(
[status] => success
[data] => stdClass Object
(
[7] => stdClass Object
(
[id] => 7
[title] => О компании
[description] =>
[parent_id] => 0
[body] => Разработать страницу «О нас» — это не только написать текст и разместить его на сайте, чтобы был. Рассказываем, как разработать страницу «О компании», чтобы она работала на ваш бизнес, а не просто висела на сайте, «как у всех». В конце приводим пошаговый пример работы над этим разделом.
[publ] => 1
[created_at] => 2022-02-08 14:33:10
[modified_at] => 2022-02-08 14:33:10
[date_news] => 2022-02-09
[files] => stdClass Object
(
[8809] => stdClass Object
(
[title] => права и статусы росреестр.xlsx
[url] => /file/load/8809
)
)
[images] => stdClass Object
(
[91] => stdClass Object
(
[title] => Chrysanthemum - копия
[description] =>
[width] => 0
[height] => 0
[url] => /images/article/91.jpg
[preview] => /images/article/91_250x250.jpg
)
)
[childs] => Array
(
)
[breadcrumbs] => Array
(
[0] => stdClass Object
(
[id] => 7
[parent_id] => 0
[title] => О компании
[publ] => 1
)
)
)
)
)
/*********************************** ** Получение списка типов объектов ** Пример: Запрос всех доступных типов объектов **********************************/ $url='http://yourdomain.intrumnet.com:81/sharedapi/stock/types'; $post = array( 'apikey' =>"4723adc21f8f06d7bd5f848438411161" ); $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($post)); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); $result = json_decode(curl_exec($ch)); curl_close ($ch);Пример ответа
stdClass Object
(
[status] => success
[data] => Array
(
[0] => stdClass Object
(
[id] => 1
[name] => Квартиры
[groups] => Array
(
)
)
[1] => stdClass Object
(
[id] => 2
[name] => Коммерческая
[groups] => Array
(
)
)
[2] => stdClass Object
(
.....
)
.....
)
)
/*********************************** ** Получение перечня и структуры дополнительных полей для типов объекта **********************************/ $url='http://yourdomain.intrumnet.com:81/sharedapi/stock/fields'; $post = array( 'apikey' =>"4723adc21f8f06d7bd5f848438411161" ); $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($post)); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); $result = json_decode(curl_exec($ch)); curl_close ($ch);Пример ответа
stdClass Object
(
[status] => success
[data] => stdClass Object
(
[3] => stdClass Object
(
[groups] => Array
(
[0] => stdClass Object
(
[id] => 0
[name] =>
[childs] => Array
(
[0] => 778
[1] => 543
[2] => 528
[3] => 546
[4] => 529
[5] => 532
[6] => 1113
[7] => 535
[8] => 1485
[9] => 626
[10] => 1485
[11] => 638
[12] => 1485
[13] => 558
[14] => 1485
[15] => 648
[16] => 1485
)
[order] => 0
)
[1] => stdClass Object
(
[id] => 12
[name] => Расположение
[order] => 2
[childs] => Array
(
[0] => 553
[1] => 554
[2] => 556
[3] => 557
[4] => 784
[5] => 787
[6] => 822
[7] => 542
[8] => 1149
[9] => 1153
[10] => 1173
)
)
[2] => stdClass Object
(
[id] => 11
[name] => Характеристики строения
[order] => 3
[childs] => Array
(
[0] => 525
[1] => 530
[2] => 533
[3] => 534
[4] => 536
[5] => 537
[6] => 538
[7] => 540
[8] => 541
[9] => 548
[10] => 531
[11] => 816
[12] => 526
[13] => 1115
[14] => 1114
[15] => 547
)
)
[3] => stdClass Object
(
[id] => 10
[name] => Характеристики участка
[order] => 4
[childs] => Array
(
[0] => 544
[1] => 527
[2] => 1100
[3] => 545
)
)
[4] => stdClass Object
(
[id] => 13
[name] => Аренда
[order] => 5
[childs] => Array
(
[0] => 549
[1] => 550
[2] => 551
[3] => 552
[4] => 1167
[5] => 1168
[6] => 1174
[7] => 1175
[8] => 1176
[9] => 1188
)
)
[5] => stdClass Object
(
[id] => 16
[name] => Выгрузки на сайты
[order] => 6
[childs] => Array
(
[0] => 1461
[1] => 1497
)
)
[6] => stdClass Object
(
[id] => 40
[name] => База собственников
[order] => 99
[childs] => Array
(
[0] => 1481
[1] => 1482
[2] => 1483
[3] => 1484
[4] => 1486
[5] => 1487
[6] => 1488
[7] => 1489
[8] => 1481
[9] => 1482
[10] => 1483
[11] => 1484
[12] => 1486
[13] => 1487
[14] => 1488
[15] => 1489
[16] => 1489
[17] => 1488
[18] => 1487
[19] => 1486
[20] => 1504
[21] => 1483
[22] => 1482
[23] => 1481
[24] => 1489
[25] => 1488
[26] => 1487
[27] => 1486
[28] => 1504
[29] => 1483
[30] => 1482
[31] => 1481
[32] => 1489
[33] => 1488
[34] => 1487
[35] => 1486
[36] => 1484
[37] => 1483
[38] => 1482
[39] => 1481
)
)
)
[fields] => stdClass Object
(
[778] => stdClass Object
(
[id] => 778
[name] => Тип недвижимости
[datatype] => select
[require] => 1
[variants] => Array
(
[0] => stdClass Object
(
[id] => 76706
[value] => дача
[bind] => 0
[default] => 0
[highlight] =>
[sort] => 0
)
[1] => stdClass Object
(
[id] => 76703
[value] => дом
[bind] => 0
[default] => 0
[highlight] =>
[sort] => 0
)
[2] => stdClass Object
(
[id] => 76704
[value] => коттедж
[bind] => 0
[default] => 0
[highlight] =>
[sort] => 0
)
[3] => stdClass Object
(
[id] => 76705
[value] => участок
[bind] => 0
[default] => 0
[highlight] =>
[sort] => 0
)
[4] => stdClass Object
(
[id] => 141792
[value] => часть дома
[bind] => 0
[default] => 0
[highlight] =>
[sort] => 0
)
)
)
[816] => stdClass Object
(
[id] => 816
[name] => Этажей в доме
[datatype] => integer
[require] => 0
)
/***********************************
** Выборка объектов по фильтру.
** Пример: Выборка по двум полям с сортировкой по полю. Лимит 500 объектов в результатах.
**********************************/
$url='http://yourdomain.intrumnet.com:81/sharedapi/stock/filter';
$params=array(
'type'=>1,
'limit'=>500,
'fields' => array(
array('id'=>470,'value'=>">=6000000"),
array('id'=>485,'value'=>"Алтуфьево,Авиамоторная")
),
'order_field' => 470,
'order'=> "desc"
);
$post = array(
'apikey' =>"535ce9c09dfdb864b249091ae3802553",
'params'=>$params
);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($post));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$result = json_decode(curl_exec($ch));
curl_close ($ch);
Пример ответа
stdClass Object
(
[status] => success
[data] => stdClass Object
(
[list] => Array
(
[0] => stdClass Object
(
[id] => 552213
[stock_type] => 1
[parent] => 3
[name] => 4-к квартира, 101.1 м², 12/24 эт.
[date_add] => 2019-01-11 22:47:33
[author] => 2
[additional_author] => Array
(
)
[last_modify] => 2019-01-11 22:47:33
[customer_relation] =>
[stock_activity_type] => comment
[stock_activity_date] => 2019-01-23 09:17:57
[publish] => 1
[copy] => 0
[group_id] => 0
[fields] => Array
(
[0] => stdClass Object
(
[id] => 446
[type] => integer
[value] => 4
)
[1] => stdClass Object
(
[id] => 447
[type] => decimal
[value] => 101.10
)
[2] => stdClass Object
(
[id] => 448
[type] => integer
[value] => 12
)
[3] => stdClass Object
(
[id] => 450
[type] => decimal
[value] => 60.00
)
[4] => stdClass Object
(
[id] => 451
[type] => decimal
[value] => 11.80
)
[5] => stdClass Object
(
[id] => 470
[type] => price
[value] => 21500000.00
)
[6] => stdClass Object
(
[id] => 471
[type] => select
[value] => руб.
)
[7] => stdClass Object
(
[id] => 481
[type] => select
[value] => Москва
)
[8] => stdClass Object
(
[id] => 482
[type] => select
[value] => Москва г
)
[9] => stdClass Object
(
[id] => 484
[type] => text
[value] =>
)
[10] => stdClass Object
(
[id] => 485
[type] => select
[value] => Алтуфьево
)
[11] => stdClass Object
(
[id] => 487
[type] => point
[value] => stdClass Object
(
[x] => 55.905497
[y] => 37.578543
)
)
[12] => stdClass Object
(
[id] => 624
[type] => text
[value] => Квартира с окнами на парк, необычная планировка , ведомственный дом, в доме подземный паркинг, консьерж, два санузла, большая лоджия(9 метров) , эркерное окно
)
[13] => stdClass Object
(
[id] => 667
[type] => select
[value] => Москва, Новгородская улица, 37
)
[14] => stdClass Object
(
[id] => 776
[type] => select
[value] => квартира вторичка
)
[15] => stdClass Object
(
[id] => 785
[type] => select
[value] => Не указан
)
[16] => stdClass Object
(
[id] => 1463
[type] => text
[value] => https://avito.ru/moskva/kvartiry/4-k_kvartira_101.1_m_1224_et._1347739163
)
[17] => stdClass Object
(
[id] => 1464
[type] => text
[value] => 83022304
)
[18] => stdClass Object
(
[id] => 1465
[type] => text
[value] => Москва, Новгородская улица, 37
)
[19] => stdClass Object
(
[id] => 1466
[type] => date
[value] => 2019-01-11
)
[20] => stdClass Object
(
[id] => 1467
[type] => multiselect
[value] => База собственников
)
[21] => stdClass Object
(
[id] => 1468
[type] => text
[value] => new
)
[22] => stdClass Object
(
[id] => 1469
[type] => text
[value] => Ирина
)
[23] => stdClass Object
(
[id] => 1470
[type] => text
[value] => 79104519513
)
[24] => stdClass Object
(
[id] => 1471
[type] => radio
[value] => 0
)
[25] => stdClass Object
(
[id] => 474
[type] => file
[value] => db/b4/5c38f2d54cb22.jpg
)
)
)
[1] => stdClass Object
(
........
)
)
)
)
/***********************************
** Добавление новых объектов
** Пример: Добавление двух объектов в категорию
**********************************/
$url='http://yourdomain.intrumnet.com:81/sharedapi/stock/insert';
$params=array(
array(
'parent'=>3,
'author'=>0, // без привязки к ответственному
'name'=> "Новостройка в центре",
'fields' => array(
array('id'=>776,'value'=>"квартира"),
array('id'=>788,'value'=>"Вариант1,Вариант2"), // для полей с типом "множественный выбор"
array('id'=>800,'value'=>"2020-06-02 13:12:47"), // для полей с типом "дата+время"
array('id'=>880,'value'=>1), // для полей с типом "да/нет"
array('id'=>870,'value'=>7.12), // для полей с типом "число"
array('id'=>878,'value'=>array('lat'=>"35.013116",'lon'=>"41.906049")), // для полей с типом "координаты"
array('id'=>879,'value'=>array('from' => 1,'to' => 2)), // для полей с типом "целое, дробное от и до"
array('id'=>888,'value'=>"89/aa/5ee243c5ca694.jpg"), array('id'=>888,'value'=>"89/aa/5ee243c86a388.jpg"), // для полей "файл" (предварительно должны быть загружены)
// *примечание по загрузке файлов ниже
array('id'=>470,'value'=>2000000),
array('id'=>624,'value'=>"Отличная квартира в хорошем районе")
)
),
array(
'parent'=>3,
'author'=>2,
'fields' => array(
array('id'=>776,'value'=>"квартира"),
array('id'=>470,'value'=>3400000),
array('id'=>447,'value'=>50)
)
)
);
$post = array(
'apikey' =>"4723adc2132f8f06d7bd5f848438411161",
'params'=>$params
);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($post));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$result = json_decode(curl_exec($ch));
curl_close ($ch);
* - предварительно файлы необходимо загрузить в систему
stdClass Object
(
[status] => success
[data] => Array
(
[0] => 519
[1] => 520
)
)
/***********************************
** Загрузка файлов
** Пример: Добавление файла в систему для последующего добавлению к объекту
**********************************/
$url='http://yourdomain.intrumnet.com:81/sharedapi/utils/upload';
$post = array(
'apikey' =>"4723adc21f3238f06d7bd5f848438411161",
'params[object]' => 'stock', //stock (объекты, продукты), applications (заявки), purchaser (контакты), sales (продажи)
'upload[0]' => curl_file_create(realpath('pic1.jpg')),
'upload[1]' => curl_file_create(realpath('pic2.jpg')),
'upload[2]' => curl_file_create(realpath('pic3.jpg')),
//'upload[0]' => '@'.realpath('/var/www/intrum/data/www/intrumnet.com/api/api.zip') // php меньше 5.5
);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$result = json_decode(curl_exec($ch));
curl_close ($ch);
Пример ответа
stdClass Object
(
[status] => success
[data] => stdClass Object
(
[name] => 5a/61/61fcc11812c0e.zip
)
)
/***********************************
** История изменений CRM сущностей
** Пример: Получить историю изменения объекта
**********************************/
$url='http://yourdomain.intrumnet.com:81/sharedapi/history/log';
$post = array(
'apikey' =>"4723adc21f8f063424d5f848438411161",
'params[object_type]' => 'stock', //stock (объекты, продукты), customer (контакты), sale (продажи), request (заявки)
'params[object_id]' => 655831, //id объекта (или массив id объектов)
'params[date][from]' => '2022-08-30 09:54:05',
'params[date][to]' => '2022-08-30 10:34:05'
);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$result = json_decode(curl_exec($ch));
curl_close ($ch);
Пример ответа
stdClass Object
(
[status] => success
[data] => Array
(
[0] => stdClass Object
(
[object_id] => 655831
[property_id] => 474
[value] =>
[current] => 88/13/5e7097d586c60.jpg
[date] => 2020-03-17 12:26:45
[employee_id] => 0
)
[1] => stdClass Object
(
[object_id] => 655831
[property_id] => 474
[value] =>
[current] => 5f/f1/5e7097d6859e5.jpg
[date] => 2020-03-17 12:26:46
[employee_id] => 0
)
[2] => stdClass Object
(
[object_id] => 655831
[property_id] => 474
[value] =>
[current] => ee/e5/5e7097d715848.jpg
[date] => 2020-03-17 12:26:47
[employee_id] => 0
)
[3] => stdClass Object
(
[object_id] => 655831
[property_id] => 474
[value] =>
[current] => 88/fb/5e7097d796fef.jpg
[date] => 2020-03-17 12:26:47
[employee_id] => 0
)
)
)
/***********************************
** Редактирование объекта
** Пример: Редактирование двух объектов
**********************************/
$url='http://yourdomain.intrumnet.com:81/sharedapi/stock/update';
$params=array(
array(
'id'=>557648,
'parent'=>3,
'author'=>6,
'name'=> "Отличный вариант в центре",
'fields' => array(
array('id'=>776,'value'=>"квартира"),
array('id'=>470,'value'=>2100000),
array('id'=>3295,'value'=>"b2/f4/657ff602bfcb2.jpg", 'mode'=>"insert"),
array('id'=>624,'value'=>"Отличная квартира в хорошем районе")
)
),
array(
'id'=>557649,
'parent'=>3,
'author'=>6,
'fields' => array(
array('id'=>776,'value'=>"квартира"),
array('id'=>470,'value'=>5300000),
array('id'=>447,'value'=>50)
)
)
);
$post = array(
'apikey' =>"4723adc21f8f06d7bd5f848438411161",
'params'=>$params
);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($post));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$result = json_decode(curl_exec($ch));
curl_close ($ch);
Пример ответа
stdClass Object
(
[status] => success
[data] => 1
)
/***********************************
** Редактирование выборки объектов по фильтру
** Пример запроса: Заменить описание на другое для объектов с фильтром по цене и метро
**********************************/
$url='http://yourdomain.intrumnet.com:81/sharedapi/stock/updateByFilter';
$params=array(
array(
'type'=>1,
'limit'=>2,
'fields' => array(
array('id'=>470,'value'=>"<=2000000"),
array('id'=>485,'value'=>"Алтуфьево")
),
'order_field' => 470,
'order'=> "desc",
'values' => array(
'property' => 624,
'type' => 'text',
'value' => "Новое описание"
)
)
);
$post = array(
'apikey' =>"4723adc21f8f06d7bd5f848438411161",
'params'=>$params
);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($post));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$result = json_decode(curl_exec($ch));
curl_close ($ch);
Пример ответа
stdClass Object
(
[status] => success
[data] => 1
)
/*********************************** ** Добавление комментариев ** Пример запроса: Добавление комментария к объекту **********************************/ $url='http://yourdomain.intrumnet.com:81/sharedapi/stock/addComment'; $params=array( array( 'entity_id'=>553450, 'text'=>"Был звонок от клиента", 'author' => 2 ) ); $post = array( 'apikey' =>"4723adc21f8f06d7bd5f848438411161", 'params'=>$params ); $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($post)); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); $result = json_decode(curl_exec($ch)); curl_close ($ch);Пример ответа
stdClass Object
(
[status] => success
[data] => stdClass Object
(
[id] => 57789
)
)
/*********************************** ** Удаление объекта ** Объект будет перемещен в корзину **********************************/ $url='http://yourdomain.intrumnet.com:81/sharedapi/stock/delete'; $params=array(557641,557643); $post = array( 'apikey' =>"4723adc21f8f06d7bd5f848438411161", 'params'=>$params ); $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($post)); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); $result = json_decode(curl_exec($ch)); curl_close ($ch);Пример ответа
stdClass Object
(
[status] => success
[data] => 1
)
/***********************************
** Прикрепления в объекту
** Получение списка прикреплений всех сущностей к объекту
**********************************/
$url='http://yourdomain.intrumnet.com:81/sharedapi/stock/attach';
$params=array('id'=>array(557649,557643));
$post = array(
'apikey' =>"4723adc21f8f06d7bd5f848438411161",
'params'=>$params
);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($post));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$result = json_decode(curl_exec($ch));
curl_close ($ch);
Пример ответа
stdClass Object
(
[status] => success
[data] => stdClass Object
(
[557649] => stdClass Object
(
[sales] => Array
(
[0] => 142
)
)
)
)
/*********************************** ** Получение списка типов заявок ** Пример: Запрос всех доступных типов заявок **********************************/ $url='http://yourdomain.intrumnet.com:81/sharedapi/applications/types'; $post = array( 'apikey' =>"4723adc21f8f06d7bd5f848438411161" ); $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($post)); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); $result = json_decode(curl_exec($ch)); curl_close ($ch);Пример ответа
stdClass Object
(
[status] => success
[data] => Array
(
[0] => stdClass Object
(
[id] => 1
[name] => Подбор для покупки квартиры
[service] => 0
[groups] => Array
(
[0] => 178
)
)
[1] => stdClass Object
(
[id] => 2
[name] => Подбор для аренды квартиры
[service] => 0
[groups] => Array
(
[0] => 178
)
)
[2] => stdClass Object
(
.....
)
.....
)
)
/*********************************** ** Получение перечня и структуры дополнительных полей для типов заявок **********************************/ $url='http://yourdomain.intrumnet.com:81/sharedapi/applications/fields'; $post = array( 'apikey' =>"4723adc21f8f06d7bd5f848438411161" ); $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($post)); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); $result = json_decode(curl_exec($ch)); curl_close ($ch);Пример ответа
stdClass Object
(
[status] => success
[data] => stdClass Object
(
[12] => stdClass Object
(
[fields] => stdClass Object
(
[1217] => stdClass Object
(
[id] => 1217
[name] => Источник
[datatype] => select
[require] => 0
[variants] => Array
(
[0] => stdClass Object
(
[id] => 3769122
[value] => E-mail рассылка
[bind] => 0
[default] => 0
[highlight] =>
[sort] => 10
)
[1] => stdClass Object
(
[id] => 3769119
[value] => Google Adwords
[bind] => 0
[default] => 0
[highlight] =>
[sort] => 7
)
)
)
[772] => stdClass Object
(
[id] => 772
[name] => Адрес объекта
[datatype] => text
[require] => 0
)
)
)
[8] => stdClass Object
(
[fields] => stdClass Object
(
[1215] => stdClass Object
(
[id] => 1215
[name] => Источник
[datatype] => select
[require] => 0
[variants] => Array
(
[0] => stdClass Object
(
[id] => 3769092
[value] => E-mail рассылка
[bind] => 0
[default] => 0
[highlight] =>
[sort] => 10
)
[1] => stdClass Object
(
[id] => 3769089
[value] => Google Adwords
[bind] => 0
[default] => 0
[highlight] =>
[sort] => 7
)
)
)
)
)
)
)
/***********************************
** Выборка заявок по фильтру.
** Пример: Выборка по двум полям с сортировкой по полю. Лимит 500 заявок в результатах.
**********************************/
$url='http://yourdomain.intrumnet.com:81/sharedapi/applications/filter';
$params=array(
'types'=>array(1),
'limit'=>500,
'fields' => array(
array('id'=>701,'value'=>">=3000000"),
array('id'=>1213,'value'=>"Сайт")
),
'statuses'=>array('processnow')
);
$post = array(
'apikey' =>"4723adc21f8f06d7bd5f848438411161",
'params'=>$params
);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($post));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$result = json_decode(curl_exec($ch));
curl_close ($ch);
Пример ответа
stdClass Object
(
[status] => success
[data] => stdClass Object
(
[list] => Array
(
[0] => stdClass Object
(
[id] => 495
[employee_id] => 2
[customer_id] => 10487
[visit_id] => 49
[request_type_id] => 1
[request_type_name] => Подбор для покупки квартиры
[source] => help_manager
[date_create] => 2022-01-01 00:00:00
[comment] =>
[request_name] =>
[status] => processnow
[request_activity_type] => stage
[request_activity_date] => 2022-01-31 15:34:06
[request_creator_id] => 2
[additional_employee_id] => Array
(
)
[fields] => stdClass Object
(
[1213] => stdClass Object
(
[id] => 1213
[datatype] => select
[value] => Сайт
)
[774] => stdClass Object
(
[id] => 774
[datatype] => integer
[value] => stdClass Object
(
[from] => 1
[to] => 2
)
)
[781] => stdClass Object
(
[id] => 781
[datatype] => decimal
[value] => stdClass Object
(
[from] => 2323.00
[to] => 32323.00
)
)
[701] => stdClass Object
(
[id] => 701
[datatype] => decimal
[value] => stdClass Object
(
[from] => 3232323.00
[to] => 3232323.00
)
)
)
)
[1] => stdClass Object
(
[id] => 502
[employee_id] => 0
[customer_id] => 10491
[visit_id] => 82
[request_type_id] => 1
[request_type_name] => Подбор для покупки квартиры
[source] => help_manager
[date_create] => 2021-08-03 17:00:17
[comment] =>
[request_name] =>
[status] => processnow
[request_activity_type] => stage
[request_activity_date] => 2022-01-31 15:34:00
[request_creator_id] => 9999999
[additional_employee_id] => Array
(
)
[fields] => stdClass Object
(
[1213] => stdClass Object
(
[id] => 1213
[datatype] => select
[value] => Сайт
)
[579] => stdClass Object
(
[id] => 579
[datatype] => radio
[value] => 0
)
[1564] => stdClass Object
(
[id] => 1564
[datatype] => radio
[value] => 1
)
[1562] => stdClass Object
(
[id] => 1562
[datatype] => date
[value] => 2021-08-19
)
[590] => stdClass Object
(
[id] => 590
[datatype] => datetime
[value] => 2021-08-03 17:00:00
)
[774] => stdClass Object
(
[id] => 774
[datatype] => integer
[value] => stdClass Object
(
[from] => 1
[to] => 2
)
)
[781] => stdClass Object
(
[id] => 781
[datatype] => decimal
[value] => stdClass Object
(
[from] => 3.00
[to] => 4.00
)
)
[701] => stdClass Object
(
[id] => 701
[datatype] => decimal
[value] => stdClass Object
(
[from] => 5000000.00
[to] => 6000000.00
)
)
)
)
)
[count] =>
)
)
/***********************************
** Добавление новых заявок
** Пример: Добавление двух заявок
**********************************/
$url='http://yourdomain.intrumnet.com:81/sharedapi/applications/insert';
$params=array(
array(
'request_type'=>1,
'employee_id'=>0, // без привязки к ответственному
'customers_id'=> 10543, // id прикрикрепленного к заявке контакту
'fields' => array(
array('id'=>1213,'value'=>"Сайт"),
array('id'=>1563,'value'=>"Вариант1,Вариант2"), // для полей с типом "множественный выбор"
array('id'=>1562,'value'=>"2020-06-02 13:12:47"), // для полей с типом "дата+время"
array('id'=>579,'value'=>1), // для полей с типом "да/нет"
array('id'=>781,'value'=>7.12), // для полей с типом "число"
array('id'=>1234,'value'=>array('lat'=>"35.013116",'lon'=>"41.906049")), // для полей с типом "координаты"
array('id'=>774,'value'=>array('from' => 1,'to' => 2)), // для полей с типом "целое, дробное от и до"
array('id'=>1845,'value'=>"89/aa/5ee243c5ca694.jpg"), array('id'=>1845,'value'=>"89/aa/5ee243c86a388.jpg"), // для полей "файл" (предварительно должны быть загружены)
// *примечание по загрузке файлов ниже
array('id'=>701,'value'=>2000000),
array('id'=>1565,'value'=>"Отличная квартира в хорошем районе")
)
),
array(
'request_type'=>2,
'employee_id'=>2,
'customers_id'=> 10542, // id прикрикрепленного к заявке контакту
'request_name'=> "Вторичка в центре",
'fields' => array(
array('id'=>1214,'value'=>"Соцсети"),
array('id'=>775,'value'=>1),
array('id'=>782,'value'=>50)
)
)
);
$post = array(
'apikey' =>"4723adc21f8f06d7bd5f848438411161",
'params'=>$params
);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($post));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$result = json_decode(curl_exec($ch));
curl_close ($ch);
* - предварительно файлы необходимо загрузить в систему
stdClass Object
(
[status] => success
[data] => Array
(
[0] => 519
[1] => 520
)
)
/***********************************
** Добавление контакта с заявкой
**********************************/
$url='http://domen.intrumnet.com:81/sharedapi/applications/addCustomer';
$params=array(
'customer'=>array(
'manager_id'=>0, // без привязки к ответственному
'name'=> "Сергей",
'surname'=> "Иванов",
'email' => array("test1@test.ru", "test2@test.ru"),
'phone' => array("79171000000", "89172000000"),
'fields' => array(
array('id'=>1200,'value'=>"Наружная реклама"),
array('id'=>633,'value'=>"Агентство")
)
),
'request'=>array(
'request_type'=>1,
'employee_id'=>2,
'fields' => array(
array('id'=>781,'value'=>array('from' => 1.0,'to' => 2.0)), // для полей с типом "целое, дробное от и до"
array('id'=>701,'value'=>array('from' => 1.0,'to' => 2.0)), // для полей с типом "целое, дробное от и до"
)
),
);
$post = array(
'apikey' =>"75304c2ef4cbaa9a296572381XXXX98f",
'params'=>$params
);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($post));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$result = json_decode(curl_exec($ch));
curl_close ($ch);
/***********************************
** Загрузка файлов
** Пример: Добавление файла в систему для последующего добавлению к объекту
**********************************/
$url='http://yourdomain.intrumnet.com:81/sharedapi/utils/upload';
$post = array(
'apikey' =>"4723adc21f8f06d7bd5f848438411161",
'params[object]' => 'applications', //stock (объекты, продукты), applications (заявки), purchaser (контакты), sales (продажи)
'upload[0]' => curl_file_create(realpath('pic1.jpg')),
'upload[1]' => curl_file_create(realpath('pic2.jpg')),
'upload[2]' => curl_file_create(realpath('pic3.jpg')),
//'upload[0]' => '@'.realpath('/var/www/intrum/data/www/intrumnet.com/api/api.zip') // php меньше 5.5
);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$result = json_decode(curl_exec($ch));
curl_close ($ch);
Пример ответа
stdClass Object
(
[status] => success
[data] => stdClass Object
(
[name] => Array
(
[0] => d3/ad/61fcc83cdb5ff.jpg
[1] => b3/29/61fcc83cdbd05.jpg
[2] => e9/2d/61fcc83cdc39f.jpg
)
)
)
/***********************************
** Редактирование объекта
** Пример: Редактирование двух объектов
**********************************/
$url='http://yourdomain.intrumnet.com:81/sharedapi/applications/update';
$params=array(
array(
'id'=>512,
'employee_id'=>6,
'customers_id'=> 10542,
'request_name'=> "Отличный вариант в центре",
'fields' => array(
array('id'=>1213,'value'=>"Сайт"),
array('id'=>1563,'value'=>"Вариант1,Вариант2"),
array('id'=>624,'value'=>"Отличная квартира в хорошем районе")
)
),
array(
'id'=>513,
'author'=>6,
'fields' => array(
array('id'=>1214,'value'=>"Соцсети"),
array('id'=>775,'value'=>1),
array('id'=>782,'value'=>50)
)
)
);
$post = array(
'apikey' =>"4723adc21f8f06d7bd5f848438411161",
'params'=>$params
);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($post));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$result = json_decode(curl_exec($ch));
curl_close ($ch);
Пример ответа
stdClass Object
(
[status] => success
[data] => 1
)
/***********************************
** Добавление комментариев
** Пример запроса: Добавление комментария к заявке
**********************************/
$url='http://yourdomain.intrumnet.com:81/sharedapi/applications/addComment';
$params=array(
array(
'entity_id'=>512,
'text'=>"Был звонок от клиента",
'author' => 2
)
);
$post = array(
'apikey' =>"4723adc21f8f06d7bd5f848438411161",
'params'=>$params
);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($post));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$result = json_decode(curl_exec($ch));
curl_close ($ch);
Пример ответа
stdClass Object
(
[status] => success
[data] => stdClass Object
(
[id] => 248072
)
)
/*********************************** ** Удаление заявки ** Объект будет перемещен в корзину **********************************/ $url='http://yourdomain.intrumnet.com:81/sharedapi/applications/delete'; $params=array(512,507); $post = array( 'apikey' =>"4723adc21f8f06d7bd5f848438411161", 'params'=>$params ); $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($post)); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); $result = json_decode(curl_exec($ch)); curl_close ($ch);Пример ответа
stdClass Object
(
[status] => success
[data] => 1
)
/***********************************
** Прикрепления в объекту
** Получение списка стадии объектов добавленных в заявке
**********************************/
$url='http://yourdomain.intrumnet.com:81/sharedapi/applications/favorite-tags';
$params=array('ids'=>array(511));
$post = array(
'apikey' =>"4723adc21f8f06d7bd5f848438411161",
'params'=>$params
);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($post));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$result = json_decode(curl_exec($ch));
curl_close ($ch);
Пример ответа
stdClass Object
(
[status] => success
[data] => stdClass Object
(
[511] => stdClass Object
(
[716667] => stdClass Object
(
[favtag] => 9
[favorite_added_at] => 2022-01-21 13:19:26
[favorite_added_by] => 2
[showing_date] => 2022-01-27 07:00:00
[history] => Array
(
[0] => stdClass Object
(
[tag] => 9
[status_tag_date] => 2022-01-21 13:19:28
[tag_employee_id] => 2
)
)
)
)
)
)
/***********************************
** Поиск сотрудников
** Пример: поиск всех сотрудников в отделе с именем Иван
**********************************/
$url='http://yourdomain.intrumnet.com:81/sharedapi/worker/filter';
$params=array(
'division_id'=>13,
'name'=>"Иван",
'fields' => array(
array('id'=>2285,'value'=>"7246")
)
);
$post = array(
'apikey' =>"4723adc21f8f06d7bd5f848438411161",
'params'=>$params
);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($post));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$result = json_decode(curl_exec($ch));
curl_close ($ch);
Пример ответа
stdClass Object
(
[status] => success
[data] => stdClass Object
(
[6] => stdClass Object
(
[id] => 6
[type] => simple
[division_id] => 13
[suboffice_id] => 1
[post] =>
[boss] => 0
[status] => onstate
[name] => Иван
[surname] => Петров
[secondname] => Сергеевич
[internalemail] => Array
(
[0] => stdClass Object
(
[email] => boss@gorod.ru
[comment] =>
)
)
[externalemail] => Array
(
)
[internalphone] => Array
(
)
[externalphone] => Array
(
)
[mobilephone] => Array
(
[0] => stdClass Object
(
[phone] => +79876543210
[comment] =>
)
)
[birthday] => 2018-11-08
[address] =>
[about] =>
[hobby] =>
[created_at] => 2018-11-20 15:16:45
[skype] =>
[facebook] =>
[vkontakte] =>
[gender] => male
[fields] => stdClass Object
(
[573] => stdClass Object
(
[id] => 573
[datatype] => text
[value] => `213456789
)
)
[avatars] => stdClass Object
(
[original] => /images/avatars/54a8cf41.jpg?1548308636
[170] => /images/avatars/54a8cf41170.jpg?1548308640
[100] => /images/avatars/54a8cf411x1.jpg?1548308640
[55] => /images/avatars/54a8cf4155.jpg?1548308640
[40] => /images/avatars/54a8cf4140.jpg?1548308640
[30] => /images/avatars/54a8cf4130.jpg?1548308640
)
)
[11] => stdClass Object (...)
...
/***********************************
** Добавление сотрудников
** Пример: Добавление сотрудника
***********************************/
$apikey = ' * Ваш API ключ * ';
$url = 'http://yourdomain.intrumnet.com:81/sharedapi/worker/add';
$params = array(
'type' => 'simple',
'status' => 'new',
'suboffice_id' => '1',
'division_id' => '14',
'name' => 'Василий',
'surname' => 'Васильев',
'login' => 'vasiav',
'password' => 'Zz12345678',
'gender' => 'male',
'emails' => json_encode(
array(
array(
'email' => 'test@test.ru',
'comment' => 'non'
)
)
),
'phones' => json_encode(
array(
array(
'phone' => '79992223311',
'comment' => 'non'
)
)
)
);
$post = array(
'apikey' => "$apikey",
'params' => $params
);
$ch = curl_init();
curl_setopt( $ch, CURLOPT_URL, $url );
curl_setopt( $ch, CURLOPT_FOLLOWLOCATION, 1 );
curl_setopt( $ch, CURLOPT_POST, 1 );
curl_setopt( $ch, CURLOPT_POSTFIELDS, http_build_query( $post ) );
curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1 );
$result = json_decode( curl_exec( $ch ), true );
curl_close( $ch );
/***********************************
** Редактирование сотрудников
***********************************/
$url="http://domen.intrumnet.com:81/sharedapi/worker/update";
$params = array(
array(
'id'=>2,
'fields' => array(
array('id'=>1278,'value' => '56'),
array('id'=>1279,'value' => 'Да'),
)
),
array(
'id'=>6,
'fields' => array(
array('id'=>1278,'value' => '20'),
array('id'=>1279,'value' => 'Нет'),
)
)
);
$post = array(
'apikey' =>"$apikey",
'params'=>$params
);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($post));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$result = json_decode(curl_exec($ch));
curl_close ($ch);
return $result;
/***********************************
** Выборка контатов по фильтру.
** Пример: Поиск контактов по имени и фильтр по значению двух полей
**********************************/
$url='http://yourdomain.intrumnet.com:81/sharedapi/purchaser/filter';
$params=array(
'search'=>"Александр",
'fields' => array(
array('id'=>1200,'value'=>"Доски объявлений"),
array('id'=>633,'value'=>"Частный риэлтор")
)
);
$post = array(
'apikey' =>"535ce9c09dfdb864b249091ae3802553",
'params'=>$params
);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($post));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$result = json_decode(curl_exec($ch));
curl_close ($ch);
Пример ответа
stdClass Object
(
[status] => success
[data] => stdClass Object
(
[list] => Array
(
[0] => stdClass Object
(
[id] => 10431
[group_id] => 0
[name] => Александр
[surname] =>
[secondname] =>
[manager_id] => 2
[email] => Array
(
[0] => stdClass Object
(
[mail] => testintrum@yandex.ru
[comment] =>
)
)
[phone] => Array
(
)
[address] =>
[create_date] => 2018-11-20 15:48:00
[comment] =>
[marktype] => 0
[nattype] => physface
[customer_activity_type] => edit
[customer_activity_date] => 2019-04-02 14:14:29
[markname] => Не выбрано
[fields] => Array
(
[0] => stdClass Object
(
[id] => 633
[datatype] => select
[value] => Частный риэлтор
)
[1] => stdClass Object
(
[id] => 1200
[datatype] => select
[value] => Доски объявлений
)
)
[additional_manager_id] => Array
(
)
)
[1] => stdClass Object
(
[id] => 10433
[group_id] => 0
[name] => Александр
[surname] => Никитенко
[secondname] =>
[manager_id] => 2
[email] => Array
(
)
[phone] => Array
(
[0] => stdClass Object
(
[phone] =>
[comment] => 9213227299
)
)
[address] =>
[create_date] => 2018-12-28 14:31:36
[comment] =>
[marktype] => 7
[nattype] => physface
[customer_activity_type] => edit
[customer_activity_date] => 2019-04-02 14:14:29
[markname] => Собственник
[fields] => Array
(
[0] => stdClass Object
(
[id] => 633
[datatype] => select
[value] => Частный риэлтор
)
[1] => stdClass Object
(
[id] => 1200
[datatype] => select
[value] => Доски объявлений
)
)
[additional_manager_id] => Array
(
)
)
)
[count] => 2
)
)
/***********************************
** Добавление новых контактов
** Пример: Добавление двух контактов
**********************************/
$url='http://yourdomain.intrumnet.com:81/sharedapi/purchaser/insert';
$params=array(
array(
'manager_id'=>0, // без привязки к ответственному
'name'=> "Сергей",
'surname'=> "Иванов",
'email' => array("test1@test.ru", "test2@test.ru"),
'phone' => array("79171000000", "89172000000"),
'fields' => array(
array('id'=>1200,'value'=>"Лидогенератор"),
array('id'=>633,'value'=>"Собственник")
)
),
array(
'name'=> "Михаил",
'manager_id'=>2,
'phone' => array("79100000000", "79100000001"),
'fields' => array(
array('id'=>1200,'value'=>"Сайт"),
array('id'=>633,'value'=>"Партнер")
)
)
);
$post = array(
'apikey' =>"4723adc21f8f06d7bd5f848438411161",
'params'=>$params
);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($post));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$result = json_decode(curl_exec($ch));
curl_close ($ch);
Пример ответа
stdClass Object
(
[status] => success
[data] => Array
(
[0] => 10434
[1] => 10435
)
)
/*********************************** ** Редактирование выборки контактов по id **********************************/ $url='http://yourdomain.intrumnet.com:81/sharedapi/purchaser/update'; $params=array( array( 'id' => 135948, 'surname' => 'Иванов', 'name' => 'Владимир', 'fields' => array( array( 'id' => 1223, 'value' => 1 ) ) ) ); $post = array( 'apikey' =>"4723adc21f8337883d5f848438411161", 'params'=>$params ); $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($post)); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); $result = json_decode(curl_exec($ch)); curl_close ($ch);Пример ответа
stdClass Object
(
[status] => success
[data] => 1
)
/*********************************** ** добавление сделки **********************************/ $url='http://domen.intrumnet.com:81/sharedapi/sales/insert'; $params=array( array( 'customers_id'=>10991, /// id контакта (обязательно) 'employee_id'=>8, /// привязки к ответственному 'sales_type_id'=> "1", 'sales_status_id'=> "1", 'sale_name'=> "Тестовая сделка" ) ); $post = array( 'apikey' =>"xXxcf5X86fa0f17xXx158bXXb34XxX", 'params'=>$params ); $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($post)); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); $result = json_decode(curl_exec($ch),true); curl_close ($ch);Пример ответа
stdClass Object
(
[status] => success
[data] => Array
(
[0] => 519
)
)
/***********************************
** смена стадии сделки по ID
**********************************/
$url="http://domen.intrumnet.com:81/sharedapi/sales/update";
$params=array(
array(
'id'=>'190', /// ID сделки
'sales_status_id'=>13, /// ID стадии сделки
)
);
$post = array(
'apikey' =>"dXXX24a84eaXXXf50925XXXd86edXXX8",
'params'=>$params
);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($post));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$result = json_decode(curl_exec($ch),true);
curl_close ($ch);
Пример ответа
Array
(
[status] => success
[data] => 1
)
/***********************************
** cписок сделок (фильтры, поиск)
**********************************/
$url='http://yourdomain.intrumnet.com:81/sharedapi/sales/filter';
$params=array(
'type'=>4,
'limit'=>500,
'count_total'=>1,
'fields' => array(
array('id'=>1210,'value'=>"Рекомендация друзей")
)
);
$post = array(
'apikey' =>"4723adc21f8f06d7bd5f848438411161",
'params'=>$params
);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($post));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$result = json_decode(curl_exec($ch));
curl_close ($ch);
?>
Пример ответа
stdClass Object
(
[status] => success
[data] => stdClass Object
(
[list] => Array
(
[0] => stdClass Object
(
[id] => 153
[customers_id] => 32234
[employee_id] => 2
[date_create] => 2018-05-28 08:23:13
[comment] =>
[sale_name] =>
[sale_type_id] => 4
[sale_stage_id] => 18
[sale_activity_type] => edit
[sale_activity_date] => 2020-09-22 11:56:00
[sale_creator_id] => 2
[additional_employee_id] => Array
(
)
[fields] => stdClass Object
(
[1459] => stdClass Object
(
[id] => 1459
[datatype] => select
[value] => Согласовано
)
[1460] => stdClass Object
(
[id] => 1460
[datatype] => multiselect
[value] => Актив; Срочно
)
[1494] => stdClass Object
(
[id] => 1494
[datatype] => radio
[value] => 0
)
[1210] => stdClass Object
(
[id] => 1210
[datatype] => select
[value] => Рекомендация друзей
)
[1434] => stdClass Object
(
[id] => 1434
[datatype] => date
[value] => 2018-05-29
)
[1430] => stdClass Object
(
[id] => 1430
[datatype] => attach
[value] => Array
(
)
)
[1507] => stdClass Object
(
[id] => 1507
[datatype] => attach
[value] => Array
(
[0] => stdClass Object
(
[object] => sale
[id] => 151
[count] => 1
)
)
)
[1508] => stdClass Object
(
[id] => 1508
[datatype] => attach
[value] => Array
(
[0] => stdClass Object
(
[object] => sale
[id] => 152
[count] => 1
)
)
)
)
)
)
[count] => 1
)
)
/***********************************
** добавление звонка
**********************************/
$url='http://yourdomain.intrumnet.com:81/sharedapi/calls/import';
$params=array(
'from'=>89101111111,
'to'=>89102222222,
'userId'=> 2,
'isIncoming'=>1,
'timestamp'=> 1645004475,
'url'=> "http://callcenter2323545.yourdomain.ru/efebfkewbwklbvwkvb.mp3",
'callDuration'=> 10,
'isAnswered'=> 1,
'tags'=> array(1,3,5),
'customStatus'=> 1
);
$post = array(
'apikey' =>"f4fe10de70560bdfe648e7f9e8bcc36d",
'params'=>$params
);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($post));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$result = json_decode(curl_exec($ch));
curl_close ($ch);
?>
Пример ответа
stdClass Object
(
[result] => 1
[callId] => ee33d0a83510244a1d29ed31fb2d674d
)
/***********************************
** вывести список звонков
**********************************/
$url='http://yourdomain.intrumnet.com:81/sharedapi/calls/history';
$params=array(
'fromPhone'=>89101111111,
'type'=>"in",
'dateTo'=> $timestamp
);
$post = array(
'apikey' =>"f4fe10de70560bdfe648e7f9e8bcc36d",
'params'=>$params
);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($post));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$result = json_decode(curl_exec($ch));
curl_close ($ch);
?>
Пример ответа
stdClass Object
(
[status] => success
[data] => Array
(
[0] => stdClass Object
(
[id] => 4
[date_time] => 2022-02-16 09:41:15
[user_id] => 2
[users] => Array
(
[0] => stdClass Object
(
[user_id] => 2
[bridged] =>
)
)
[is_incoming] => 1
[is_answered] => 1
[custom_status] => 1
[from_phone] => 79101111111
[to_phone] => 79102222222
[trunk_id] => 0
[tags] => Array
(
[0] =>
[1] => Array
(
[id] => 2
[title] => Юла
[color] => red
)
)
[call_duration] => 10
[url_record] => https://miel.intrumnet.com/files/records/2022/02/16/efebfkewbwklbvwkvb.m.ogg
[url_record_stereo] =>
)
[1] => stdClass Object
(
[id] => 3
[date_time] => 2022-02-16 09:41:04
[user_id] => 2
[users] => Array
(
[0] => stdClass Object
(
[user_id] => 2
[bridged] =>
)
)
[is_incoming] => 1
[is_answered] => 1
[custom_status] => 1
[from_phone] => 79101111111
[to_phone] => 79102222222
[trunk_id] => 0
[call_duration] => 10
[url_record] => https://miel.intrumnet.com/files/records/2022/02/16/efebfkewbwklbvwkvb.m.ogg
[url_record_stereo] =>
)
)
[count] =>
)
/***********************************
** Добавление новых контактов
** Пример: Добавление двух контактов
**********************************/
$url='http://yourdomain.intrumnet.com:81/sharedapi/org_events/insert';
$params = array(
'event' => array(
'dtstart' => time() + 86400 ,
'dtend' => time() + 86400 ,
'summary' => "Название нового события" ,
'description' => "Описание нового события" ,
'dtoffset' => 180 ,
'author_id' => 1 ,
'bg-color' => '#ff0000'
)
);
$post = array(
'apikey' =>"4723adc21f8f06d7bd5f848438411161",
'params'=>$params
);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($post));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$result = json_decode(curl_exec($ch));
curl_close ($ch);
Пример ответа
stdClass Object
(
[status] => success
[data] => stdClass Object
(
[event_id] => 1
[uid] => b04839623ecb45f446e6b6ef9eb9a1e2
)
)