Skip to content

R7K12 — CRM API: full method reference

Base URL for all methods: https://api.r7k12.com/{TOKEN}/<метод> (TOKEN is the account API key).


addLeads (POST)

addLeads method

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

Name Value Required Description
id string Yes Unique deal ID in the CRM
name string No Deal name in the CRM (500 characters max).
dateCreate unix time Yes Deal creation date in UNIX format
status string Yes Deal status ID in the CRM. For deals to be processed correctly, you must upload the statuses using the setStatuses method
dateChangeStatus string No Status change date in Y-m-d format
type string No Inquiry type (Form/Ringostat/Tilda, etc.)
r7k12id string No Unique R7K12 visit ID (or visit source)
price float No Deal amount
cost float No Deal cost of goods
clientId string No Client ID in the CRM
manager string No ID of the manager responsible for the deal
shop string No Store the deal belongs to
appealUrl string No Full URL of the page from which the order was placed. Example: https://magazine.com/page1/product5/?c=1#block=1
appeals integer No Number of inquiries for the deal
appealId string No Inquiry ID obtained with the getAppeals method
number integer No Sequence number of the deal for the contact
products array[object] No Array of products related to the deal (see Table 2).
payment array[object] No Payments for the deal (see Table 3)
fields object No Additional deal fields

Table 2

Name Value Required Description
id string Yes Unique product ID
name string Yes Product name
price float Yes Unit price of the product
quantity integer Yes Quantity

Table 3

Name Value Required Description
id string Yes Unique payment ID
sum float Yes Payment amount
status integer Yes Payment status (1 - payment made, -1 - payment canceled)
date string Yes Payment date. Format YYYY-MM-DD

Request body example:

[
 {
   "id":"1",
   "name":"Сделка №1",
   "dateCreate": 1508746231,
   "status":"57667454",
   "dateChangeStatus":"2017-10-21",
   "type":"Form",
   "r7k12id": "14154465",
   "price":80.6,
   "cost":70,
   "clientId":"876",
   "manager": 5,
   "products": [
     {
       "id": "1",
       "name": "Продукт 1",
       "price": 0,
       "quantity": 1
     },
     {
       "id": "2",
       "name": "Продукт 2",
       "price": 124.6,
       "quantity": 2
     }
   ],
   "payment": [
     {
       "id": "6458erg",
       "sum": 50,
       "status": 1,
       "date": "2018-04-16"
     },
     {
       "id": "jf94ksm",
       "sum": 100,
       "status": 1,
       "date": "2018-04-20"
     }
   ],
   "fields": {
     "1": "fields 1",
     "45": "fields 3"
   }
 },
 {
   "id":"2",
   "name":"Сделка №2",
   "dateCreate": 1508746531,
   "status":"7454",
   "r7k12id": "site_offline"
 },
 {
   "id":"3",
   "name":"Сделка №3",
   "dateCreate": 1509746531,
   "status":"744"
 }
]

Response example:

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

Script example (PHP):

define('TOKEN','XXXXXXXXX');
@file_get_contents(
   'https://api.r7k12.com/'.TOKEN.'/addLeads',
   0,
   stream_context_create(
       [
           'http' => [
               'method' => "POST",
               'header' => "Content-Type: application/json\r\n",
               'content' => json_encode(
                   [
                       [
                           'id' => '1',
                           'name' => 'Сделка №1',
                           'dateCreate' => 1508746231,
                           'status' => '57667454',
                           'type' => 'Form',
                           'r7k12id' => '14154465',
                           'price' => 80.6,
                           'cost' => 70,
                           'clientId' => '876',
                           'manager' => '5',
                           'shop' =>  'магазин',
                           'products' => [
                               [
                                   'id' => '1',
                                   'name' => 'Продукт 1',
                                   'price' => 0,
                                   'quantity' => 1
                               ],
                               [
                                   'id' => '2',
                                   'name' => 'Продукт 2',
                                   'price' => 124.6,
                                   'quantity' => 2
                               ]
                           ],
                           'fields' => [
                               '1' => 'fields 1',
                               '45' => 'fields 3'
                           ]
                       ],
                       [
                           'id' => '2',
                           'name' => 'Сделка №2',
                           'dateCreate' => 1508746531,
                           'status' => '7454',
                           'r7k12id' => 'site_offline',
                       ],
                       [
                           'id' => '3',
                           'name' => 'Сделка №3',
                           'dateCreate' => 1509746531,
                           'status' => '744',
                       ]
                   ]
               )
           ]
       ]
   )
);

getLeads (GET)

getLeads method

getLeads

The method returns a list of deals, including those created through the R7K12 service. The method returns no more than 10000 records per call; each response includes the “totalResult” parameter with the total number of results. Method: GET Link: https://api.r7k12.com/{{TOKEN}}/getLeads Parameters: Table 1 Table 1

Parameter Type Required Description
id string No Unique deal ID in the CRM. If this parameter is used, the response will contain the deal with the specified ID (if it exists).
lastModified string No Date the deal was last modified. Format: - YYYY-MM-DD HH:MM:SS - YYYY-MM-DD. If this parameter is specified, the response will include only the deals that were modified/created after the specified date.
fields array [string] No List of fields to include in the response. If the parameter is not set, only IDs are returned. Available fields: - id - deal ID - r7k12id - “visit” ID - name - deal name - status - deal status - type - inquiry type - dateCreate - creation date (UNIX) - lastModified - modification date - price - deal amount - cost - deal cost of goods - clientId - CRM client ID - manager - ID of the manager responsible for the deal - products - array of products - fields - additional deal fields
limit integer No Number of records to return in the result (default “10000”)
page integer No Number of the page to return (default “1”)

Request example:

define('TOKEN','XXXXXXXXX');
$data = @file_get_contents(
   'https://api.r7k12.com/'.TOKEN.'/getLeads?'.
   http_build_query(
       [
           'lastModified' => '2017-11-11',
           'fields' => [
               'id',
               'status',
               'price',
               'cost',
               'fields'
           ],
    'limit'=> 1
       ]
   )
);

Response:

{
 "page" : 1,
 "totalResult": 156,
 "data": [
   {
     "id" : "1",
     "status" : "587",
     "price" : 0,
     "cost" : 0,
     "fields" : {
       "source1" : "yandex",
       "source2" : "organic",
       "source3" : "(not set)"
     }
   }
 ]
}

updateLeads (POST)

updateLeads method

Updates information on existing deals. Lets you update any deal parameter (except the ID). The response returns an array of IDs of updated deals and/or an array of IDs of deals that were not updated, with the reason. Method: POST Format: JSON Link: https://api.r7k12.com/{{TOKEN}}/updateLeads Parameters: Table 1 Content-type: application/json Table 1

Name Value Required Description
id string Yes Unique ID of the deal being updated in the CRM
name string No Deal name in the CRM (500 characters max).
status string No Deal status ID in the CRM.
dateChangeStatus string No Status change date in Y-m-d format
type string No Inquiry type (Form/Ringostat/Tilda, etc.)
type string No Inquiry type (Form/Ringostat/Tilda, etc.)
price float No Deal amount
cost float No Deal cost of goods
clientId string No Client ID in the CRM
manager string No ID of the manager responsible for the deal
shop string No Store the deal belongs to
appealUrl string No Full URL of the page from which the order was placed. Example: https://magazine.com/page1/product5/?c=1#block=1
appeals integer No Number of inquiries for the deal
appealId string No Inquiry ID obtained with the getAppeals method
number integer No Sequence number of the deal for the contact
products array[object] No Array of products related to the deal (see Table 2).
payment array[object] No Payments for the deal (see Table 3)
fields object No Additional deal fields. Note: if the “fields” parameter is sent, it is overwritten completely

Table 2

Name Value Required Description
id string Yes Unique product ID
name string Yes Product name
price float Yes Unit price of the product
quantity integer Yes Quantity

Table 3

Name Value Required Description
id string Yes Unique payment ID
sum float Yes Payment amount
status integer Yes Payment status (1 - payment made, -1 - payment canceled)
date string Yes Payment date. Format YYYY-MM-DD

Request body example:

[
 {
   "id":"1",
   "name":"Сделка закрыта"//Обновить название сделки
   "status":"100"//Обновить статус сделки
 }, 
 {
   "id":"2",
   "price":7454//Обновить сумму сделки
 }, 
 {
   "id":"3",
   "products": [//Обновить список продуктов
     {
       "id": "1",
       "name": "Продукт 1",
       "price": 0,
       "quantity": 1
     },
     {
       "id": "2",
       "name": "Продукт 2",
       "price": 124.6,
       "quantity": 2
     }
   ]
 }
]

Response example:

{
 "update" : [1,2,3],
 "notUpdate" : [
   {
     "id" : NULL,
     "message" : "Не указан идентификатор сделки"
   },
   {
     "id" : 5,
     "message" : "Сделка с указанным идентификатором не существует"
   }
 ]
}

Script example (PHP):

define('TOKEN','XXXXXXXXX');
@file_get_contents(
   'https://api.r7k12.com/'.TOKEN.'/updateLeads',
   0,
   stream_context_create(
       [
           'http' => [
               'method' => "POST",
               'header' => "Content-Type: application/json\r\n",
               'content' => json_encode(
                   [
                       [
                           'id' => '1',
                           'name' => 'Сделка закрыта',
                           'status' => '100'
                       ],
                       [
                           'id' => '2',
                           'price' => 7454
                       ],
                       [
                           'id' => '3',
                           'products' => [
                               [
                                   'id' => '1',
                                   'name' => 'Продукт 1',
                                   'price' => 0,
                                   'quantity' => 1
                               ],
                               [
                                   'id' => '2',
                                   'name' => 'Продукт 2',
                                   'price' => 124.6,
                                   'quantity' => 2
                               ]
                           ]
                       ]
                   ]
               )
           ]
       ]
   )
);

deleteLeads (POST)

deleteLeads method

deleteLeads

The method deletes deals. Method: POST Format: JSON Link: https://api.r7k12.com/{{TOKEN}}/deleteLeads Parameters: Table 1 Content-type: application/json Table 1

Name Value Required Description
ids array[string] Yes Array of unique IDs of the deals to delete

Request body example:

{
 "ids" : [1,2,3]
}

Script example (PHP):

define('TOKEN','XXXXXXXXX');
@file_get_contents(
   'https://api.r7k12.com/'.TOKEN.'/deleteLeads',
   0,
   stream_context_create(
       [
           'http' => [
               'method' => "POST",
               'header' => "Content-Type: application/json\r\n",
               'content' => json_encode(
                   [
                       'ids' => [1, 2, 3]
                   ]
               )
           ]
       ]
   )
);

addContacts (POST)

addContacts method

addContacts

Uploads information on new contacts. The response returns an array of IDs of saved contacts and/or an array of IDs of contacts that were not uploaded, with the reason. Method: POST Format: JSON Link: 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'
       ]
   ]
]
               )
           ]
       ]
   )
);

getContacts (GET)

getContacts method

getContacts

The method returns a list of contacts, including those created through the R7K12 service. The method returns no more than 10000 records per call; each response includes the “totalResult” parameter with the total number of results. Method: GET Link: https://api.r7k12.com/{{TOKEN}}/getContacts Parameters: Table 1 Table 1

Parameter Type Required Description
id string No Unique contact ID in the CRM. If this parameter is used, the response will contain the contact with the specified ID (if it exists).
lastModified string No Date the contact was last modified. Format: - YYYY-MM-DD HH:MM:SS - YYYY-MM-DD. If this parameter is specified, the response will include only the contacts that were modified/created after the specified date.
fields array [string] No List of fields to include in the response. If the parameter is not set, only IDs are returned. Available fields: - id - contact ID - name - contact name - phone - array of phone numbers - email - array of email addresses - leads - array of deal IDs - dateCreate - creation date (UNIX) - lastModified - modification date (UNIX)
limit integer No Number of records to return in the result (default “10000”)
page integer No Number of the page to return (default “1”)

Request example:

define('TOKEN','XXXXXXXXX');
$data = @file_get_contents(
   'https://api.r7k12.com/'.TOKEN.'/getContacts?'.
   http_build_query(
       [
           'fields' => [
               'id',
               'phone',
               'leads'
           ],
           'limit' => 1
       ]
   )
);

Response:

{
 "page" : 1,
 "totalResult": 100,
 "data": [
   {
     "id" : "43",
     "phone" : [
       "380441234567",
       "380503215476"
     ],
     "leads" : [
       "1"
     ]
   }
 ]
}

updateContacts (POST)

updateContacts method

updateContacts

Updates information on existing contacts. Lets you update any contact parameter (except the ID). The response returns an array of IDs of updated contacts and/or an array of IDs of contacts that were not updated, with the reason. Method: POST Format: JSON Link: https://api.r7k12.com/{{TOKEN}}/updateContacts Parameters: Table 1 Content-type: application/json Table 1

Parameter Type Required Description
id string Yes Unique contact ID in the CRM.
name string No Contact name
phone array [string] No Array of new contact phone numbers to add
email array [string] No Array of contact e-mail addresses to add
leads array [string] No Array of IDs of the deals this contact belongs to that need to be added

Request body example:

[
 {
   "name": "Name update",
   "id": "1"
 },
 {
  "id": "2",
   "phone": [
     "380441234560"
   ]
 },
 {
   "id": "3",
   "email": [
     "[email protected]"
   ],
   "leads": [
     "679"
   ]
 }
]

Response example:

{
 "upload" : [1,2,3],
 "notUpdate" : [,
   {
     "id" : 5,
     "message" : "Контакт с указанным идентификатором не существует"
   }
 ]
}

Script example (PHP):

define('TOKEN','XXXXXXXXX');
@file_get_contents(
   'https://api.r7k12.com/'.TOKEN.'/updateContacts',
   0,
   stream_context_create(
       [
           'http' => [
               'method' => "POST",
               'header' => "Content-Type: application/json\r\n",
               'content' => json_encode(
                   [
   [
       'name' => 'Name update',
       'id' => '1'
   ],
   [
       'id' => '2',
       'phone' => [
           '380441234560'
       ]
   ],
   [
       'id' => '3',
       'email' => [
           '[email protected]'
       ],
       'leads' => [
           '679'
       ]
   ]
]
               )
           ]
       ]
   )
);

deleteContacts (POST)

deleteContacts method

deleteContacts

The method deletes deals. Method: POST Format: JSON Link: https://api.r7k12.com/{{TOKEN}}/deleteContacts Parameters: Table 1 Content-type: application/json Table 1

Name Value Required Description
ids array[string] Yes Array of unique IDs of the contacts to delete

Request body example:

{
"ids" : [1,2,3]
}

Script example (PHP):

define('TOKEN','XXXXXXXXX');
@file_get_contents(
   'https://api.r7k12.com/'.TOKEN.'/deleteContacts',
   0,
   stream_context_create(
       [
           'http' => [
               'method' => "POST",
               'header' => "Content-Type: application/json\r\n",
               'content' => json_encode(
                   [
                       'ids' => [1, 2, 3]
                   ]
               )
           ]
       ]
   )
);

setStatuses (POST)

setStatuses method

Uploads deal statuses. If a status is sent with an ID already stored in the R7K12 service, the status will be updated. Method: POST Format: JSON Link: https://api.r7k12.com/{{TOKEN}}/setStatuses Parameters: Table 1 Content-type: application/json Table 1

Name Value Required Description
id string Yes Unique status ID in the CRM
group integer Yes Group the status belongs to. Value from 1 to 4. - 1 - Not counted - 2 - In progress - 3 - Completed - 4 - Canceled
name string No Status name in the CRM (500 characters max).

Request body example:

[
 {
   "id":"56385",
   "group":"1",//Не учитывать
   "name":"Новый заказ"
 },
 {
   "id":"57667454",
   "group":"3"//Успешно реализовано
 }
]

Script example (PHP):

define('TOKEN','YOURTOKEN');
@file_get_contents(
   'https://api.r7k12.com/'.TOKEN.'/setStatuses',
   0,
   stream_context_create(
       [
           'http' => [
               'method' => "POST",
               'header' => "Content-Type: application/json\r\n",
               'content' => json_encode(
                   [
                       [
                           'id' => '56385',
                           'group' => '1',
                           'name' => 'Новый заказ'
                       ],
                       [
                           'id' => '57667454',
                           'group' => '3'
                       ],
                   ]
               ),
           ],
       ]
   )
);

setManagers (POST)

setManagers method

The method uploads the list of CRM managers. If a manager is sent with an ID already stored in the R7K12 service, the manager's name will be updated. Method: POST Format: JSON Link: https://api.r7k12.com/{{TOKEN}}/setManagers Parameters: Table 1 Content-type: application/json Table 1

Name Value Required Description
id string Yes Unique manager ID in the CRM
name string Yes Manager name

Request body example:

[
 {
   "id":"1",
   "name":"Менеджер №1"
 },
 {
   "id":"2",
   "name":"Менеджер №2"
 }
]

Script example (PHP):

define('TOKEN','YOURTOKEN');
@file_get_contents(
   'https://api.r7k12.com/'.TOKEN.'/setManagers',
   0,
   stream_context_create(
       [
           'http' => [
               'method' => "POST",
               'header' => "Content-Type: application/json\r\n",
               'content' => json_encode(
                   [
                       [
                           'id' => '1',
                           'name' => 'Менеджер №1'
                       ],
                       [
                           'id' => '2',
                           'name' => 'Менеджер №2'
                       ],
                   ]
               ),
           ],
       ]
   )
);

getAppeals (GET)

getAppeals method

getAppeals

The method returns a list of inquiries received by the R7K12 service. The method returns no more than 10000 records per call; each response includes the “totalResult” parameter with the total number of results. Method: GET Link: https://api.r7k12.com/{{TOKEN}}/getAppeals Parameters: Table 1 Table 1

Parameter Type Required Description
date string No Date the inquiry was received by the system. Format: - YYYY-MM-DD HH:MM:SS - YYYY-MM-DD. If this parameter is specified, the response will include only the inquiries that were created after the specified date.
phone string No Phone number specified in the inquiry. Must consist of digits only If specified, only the inquiries whose phone number matches the given number will be returned.
email string No E-mail address specified in the inquiry. Must be a valid e-mail address. If specified, only the inquiries whose phone number matches the given email will be returned.
fields array [string] No List of fields to include in the response. If the parameter is not set, only session IDs (r7k12id) are returned. Available fields: - id - inquiry ID - r7k12id - session ID - name - name specified in the inquiry - phone - phone number - email - email address - comment - comment - date - creation date (UNIX) - type - inquiry type - call_duration - call duration - call_record - link to the call recording - call_status - call status - price - deal price - href - link to the page from which the request was submitted - raw_data - request data in the form in which it was received
limit integer No Number of records to return in the result (default “10000”)
page integer No Number of the page to return (default “1”)

Request example:

define('TOKEN','XXXXXXXXX');

$data = @file_get_contents(

  'https://api.r7k12.com/'.TOKEN.'/getAppeals?'.

  http_build_query(

      [

          'fields' => [

              'r7k12id',

              'name',

              'phone',

              'email'

          ],

          'limit' => 1

      ]

  )

);

Ответ:

{

"page" : 1,

"totalResult": 100,

"data": [

  {

    "r7k12id" : "4239487948343",

    "name" : "Contact’s Name",

    "phone" : "380441234567",

    "email" : "[email protected]"

  }

]

}

updateIdsEssenceCrm (POST)

updateIdsEssenceCrm method

updateIdsEssenceCrm

The method updates the unique ID of a CRM entity (contact/deal). This method is suitable for the “Custom CRM” integration when the data sending module is used and you need to replace the CRM entity ID assigned by the R7K12 service with your own. Method: POST Format: JSON Link: https://api.r7k12.com/{{TOKEN}}/updateIdsEssenceCrm Parameters: Table 1 Content-type: application/json Table 1

Name Value Required Description
type ENUM (‘lead’, ’contact’) Yes Type of the CRM entity whose ID needs to be changed
oldId string Yes Entity ID that is currently set.
newId string Yes Entity ID that needs to be set.

Request body example:

[
 {
   "type":"lead",
   "oldId":"jf97gaossz",
   "newId":"301cb030-4126-4065-94d9-8dc2a345573d"
 },
 {
   "type":"lead",
   "oldId":"6y62zhzifs",
   "newId":"2ed7874b-3646-499b-a54e-ccd31a843527"
 },
 {
   "type":"contact",
   "oldId":"3reuqfl2di",
   "newId":"f77b6a3f-aab3-4a80-b752-cdfe15ae31b2"
 }
]

Response example:

[
 {
   "type":"lead",
   "id":"jf97gaossz",//oldId
   "status":"success"
 },
 {
   "type":"lead",
   "id":"6y62zhzifs",
   "status":"error",
   "error_message":"Новый идентификатор не является уникальным"
 },
 {
   "type":"contact",
   "id":"3reuqfl2di",
   "status":"success"
 }
]

Script example (PHP):

define('TOKEN','XXXXXXXXX');
@file_get_contents(
   'https://api.r7k12.com/'.TOKEN.'/updateIdsEssenceCrm',
   0,
   stream_context_create(
       [
           'http' => [
               'method' => "POST",
               'header' => "Content-Type: application/json\r\n",
               'content' => json_encode(
                   [
                       [
                           'type' => 'lead',
                           'oldId' => 'jf97gaossz',
                           'newId' => '301cb030-4126-4065-94d9-8dc2a345573d'
                       ],
                       [
                           'type' => 'lead',
                           'oldId' => '6y62zhzifs',
                           'newId' => '2ed7874b-3646-499b-a54e-ccd31a843527'
                       ],
                       [
                           'type' => 'contact',
                           'oldId' => '3reuqfl2di',
                           'newId' => 'f77b6a3f-aab3-4a80-b752-cdfe15ae31b2'
                       ]
                   ]
               )
           ]
       ]
   )
);

setShippingTrackingId (POST)

setShippingTrackingId method

The method adds or updates the shipment tracking number in a deal. When a waybill number is specified, the delivery service must be connected in the R7K12CRM integrations. The maximum number of input items is 100. Method: POST Link: https://api.r7k12.com/{{TOKEN}}/R7K12Crm Parameters: Table No. 1 Input data:

{

 "method": "setShippingTrackingId",

 "input": [

   {

     "dealId": (string),

     "type": (string),

     "shippingId": (string)

   },

   ...

 ]

}

Table No. 1

Parameter Type Required Description
method string Yes Method being called. Always “setShippingTrackingId”
input array[object] Yes Method input parameters
input[index].dealId string Yes Deal ID
input[index].type string Yes ID of the delivery service the tracking number belongs to - “novaPoshta” - Nova Poshta
input[index].shippingId string Yes Shipment tracking number

Request example:

define('TOKEN','YOURTOKEN');

function POST ($request) {
   $curl = curl_init();
   curl_setopt($curl, CURLOPT_URL, 'https://api.r7k12.com/'.TOKEN.'/R7K12Crm');
   curl_setopt($curl, CURLOPT_RETURNTRANSFER,true);
   curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl, CURLOPT_POSTFIELDS, json_encode($request,JSON_UNESCAPED_UNICODE));
   $out = curl_exec($curl);
   curl_close($curl);
   return json_decode($out,true);
}

$response = POST(
   [
            'method' => 'setShippingTrackingId' ,
            'input' => [
                    [
'dealId' => '5e450c947e7c21254b42a942',
'fields' => 'novaPoshta',
'fields' => '1234567890',
]
]
       ]
);

print_r($response);

Response handling:

{

 "success": true,

 "warning": [

   {

     "dealId": (string),

     "type": (syting),

     "shippingId": (string),

     "error": (string)

   }

 ]

}

Table No. 2

Parameter Type Required Description
success true No Flag indicating that all uploaded data was processed successfully. Present only if all data was processed successfully
warning array[object] No Array of unprocessed input data
warning[index].dealId string Yes Deal ID
warning[index].type string Yes ID of the delivery service the tracking number belongs to - “novaPoshta” - Nova Poshta
warning[index].shippingId string Yes Shipment tracking number
warning[index].error string Yes Reason the data was not processed: - Field "dealId": must be string (a-z0-9) - Deal not found - Incorrect field "shippingId" - Incorrect shipping system - The electronic invoice number "XXXXX" is already set on another deal - Shipping system is not enabled

API errors

Response format:

{

 "error": {

   "code": (int),

   "error": (string),

   "error_detail": (string)

 }

}

Table No. 3

Code Error Description
-1 Could not complete the request An internal API error occurred. Contact technical support and provide the requestId
20 Invalid access key
21 Invalid method
22 Invalid data format
23 Required parameters are missing
24 API integration is not connected
25 Write error
26 The maximum number of records per request is 100
27 The interval between requests must be at least 3 seconds
28 No access to the selected project
29 Insufficient permissions to perform this method
210 A user access key is required to perform the selected method You need to obtain the key via the OAUTH2 flow
211 The access token is blocked Contact technical support for more information
212 Requests with the same methods cannot be executed in parallel The selected API method is already being used in a parallel request with the specified token
301 Invalid API Method An invalid R7K12 CRM API method was called
302 R7K12 CRM is not connected in the project R7K12 CRM is not connected in the project
303 Integration not connected in R7K12 CRM The integration is not connected within R7K12 CRM
304 Incorrect input data Incorrect input data
305 A lot of data The maximum number of input items has been exceeded