Skip to content

updateIdsEssenceCrm method

updateIdsEssenceCrm

The method lets you update 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 URL: 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'
                       ]
                   ]
               )
           ]
       ]
   )
);