Overwrite relation properties
Description
Replaces relation properties' values with the ones you send with this request.
note
In case no relation between the specified profiles exists — a new relation will be created.
tip
If you need to increase or decrease relation properties, use Modify relation properties endpoint.
URL
Method: POST.
https://example.com/api/v1.1/relations/edit
Request parameters
| Parameter | Type | Example | Required | Description | 
|---|---|---|---|---|
| token | string | "abcdefghijklmnqrstuvwxyz" | Yes | API token | 
| rel_id | int | 3 | Yes | Relation ID | 
| profile_a | object | {"profile_id": "c1wefohoi1312"} | Yes | Database A profile - relation recipient (object). | 
| profile_b | object | {"profile_id": "c1wefohoi13123"} | Yes | Database B profile - relation initiator (subject). | 
| weights | object | {"user_like": 2, "donate": 343, "is_online": true} | Yes | Relation properties | 
| Profile matching mode | ||||
| matching | string | "email" "email_profile" "phone" "profile_id" "custom" | No, if matched by email from profile or subscriptions | Profile matching mode By default - email | 
| string | "john@example.com" | "matching":"email" - both profile data and subscriptions "matching":"email_profile" - profile data only | Email address | |
| phone | string | "+79000000000" | "matching":"phone" | Phone number | 
| profile_id | string | "abcdefghijklmnqrstuvwxyz" | "matching":"profile_id" | Profile ID | 
| field_name | string | "CRM_ID" | "matching":"custom" | Custom profile data field name | 
| field_value | int/string | "123420" | "matching":"custom" | Custom profile data field value. | 
| resource_id | int | 24 | No | Resource ID for email and phone matching | 
Request example
- JSON
- XML
{
    "token": "abcdefghijklmnqrstuvwxyz",
    "rel_id": 3,
    "profile_a": {
        "profile_id": "5d63dbdb439e7306b596c5d0"
    },
    "profile_b": {
        "profile_id": "5d441038439e7363f3c26539"
    },
    "weights": {
        "user_like": 2,
        "donate": 343,
        "is_online": true
    }
}
<xml>
  <token>abcdefghijklmnqrstuvwxyz</token>
  <rel_id>3</rel_id>
  <profile_a>
    <profile_id>5d63dbdb439e7306b596c5d0</profile_id>
  </profile_a>
  <profile_b>
    <profile_id>5d441038439e7363f3c26539</profile_id>
  </profile_b>
  <weights>
    <user_like>2</user_like>
    <donate>343</donate>
    <is_online>true</is_online>
  </weights>
</xml>
Response example
- JSON
- XML
{
    "error": 0,
    "error_text": "",
    "profile_a": "5c910f6bc484d023b1309bee",
    "profile_b": "5c910938c484d023b1309bac",
    "relation_id": 1
}
<xml>
<error>0</error>
  <error_text></error_text>
  <profile_a>5c910f6bc484d023b1309bee</profile_a>
  <profile_b>5c910938c484d023b1309bac</profile_b>
  <relation_id>1</relation_id>
</xml>
Response parameters
| Parameter | Type | Description | 
|---|---|---|
| error | int | Error code | 
| error_text | string | Error description | 
| profile_a | string | Database A profile | 
| profile_b | string | Database B profile | 
| relation_id | int | Relation ID |