Skip to content

addContacts method

addContacts

Uploads information about new contacts. The response returns an array of IDs of the saved contacts and/or an array of IDs of the contacts that were not uploaded, with a description of the reason. Method: POST Format: JSON URL: https://api.r7k12.com/{{TOKEN}}/addContacts Parameters: Table 1 Content-type: application/json

Parameter Type Required Description
id string Yes Unique contact ID in the CRM.
name string No Contact name
dateCreate double (UNIX) Yes Contact creation date
phone array [string] No (if e-mail is provided) Array of the contact's phone numbers
email array [string] No (if phone is provided) Array of the contact's e-mail addresses
leads array [string] No Array of IDs of the deals this contact belongs to.

Request body example:

[
 {
   "name": "Контакт 1",
   "id": "1",
   "dateCreate": 1497800760,
   "phone": [
     "380441234567",
     "380443215476"
   ],
   "email": [
     "[email protected]",
     "[email protected]"
   ],
   "leads": [
     "150",
     "6583"
   ]
 },
 {
   "name": "Контакт 2",
   "id": "2",
   "dateCreate": 1497800760,
   "phone": [
     "380441234568"
   ]
 },
 {
   "name": "Контакт 3",
   "id": "3",
   "dateCreate": 1497800760,
   "email": [
     "[email protected]"
   ],
   "leads": [
     "67889"
   ]
 }
]

Response example:

{
 "upload" : [1,2,3],
 "notUpload" : [
   {
     "id" : 4,
     "message" : "Не указан параметр 'dateСreate'"
   },
   {
     "id" : 5,
     "message" : "Контакт с указанным идентификатором уже существует"
   }
 ]
}

Script example (PHP):

define('TOKEN','XXXXXXXXX');
@file_get_contents(
   'https://api.r7k12.com/'.TOKEN.'/addContacts',
   0,
   stream_context_create(
       [
           'http' => [
               'method' => "POST",
               'header' => "Content-Type: application/json\r\n",
               'content' => json_encode(
                   [
   [
       'name' => 'Контакт 1',
       'id' => '1',
       'dateCreate' => 1497800760,
       'phone' => [
           '380441234567',
           '380443215476'
       ],
       'email' => [
           '[email protected]',
           '[email protected]'
       ],
       'leads' => [
           '150',
           '6583'
       ]
   ],
   [
       'name' => 'Контакт 2',
       'id' => '2',
       'dateCreate' => 1497800760,
       'phone' => [
           '380441234568'
       ]
   ],
   [
       'name' => 'Контакт 3',
       'id' => '3',
       'dateCreate' => 1497800760,
       'email' => [
           '[email protected]'
       ],
       'leads' => [
           '67889'
       ]
   ]
]
               )
           ]
       ]
   )
);