Skip to content

updateLeads method

Updates information about existing deals. Lets you update any deal parameter (except the ID). The response returns an array of IDs of the updated deals and/or an array of IDs of the deals that were not updated, with a description of the reason. Method: POST Format: JSON URL: 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 system
name string No Deal name in the CRM system (no more than 500 characters).
status string No ID of the deal status in the CRM system.
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 (described in Table 2).
payment array[object] No Payments for the deal (described in 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 Price per product unit
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 completed, -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
                               ]
                           ]
                       ]
                   ]
               )
           ]
       ]
   )
);