Skip to main content

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

ParameterTypeExampleRequiredDescription
tokenstring"abcdefghijklmnqrstuvwxyz"YesAPI token
rel_idint3YesRelation ID
profile_aobject
{"profile_id": "c1wefohoi1312"}
YesDatabase A profile - relation recipient (object).
profile_bobject
{"profile_id": "c1wefohoi13123"}
YesDatabase B profile - relation initiator (subject).
weightsobject
{"user_like": 2, "donate": 343, "is_online": true}
YesRelation properties
Profile matching mode
matchingstring"email"
"email_profile"
"phone"
"profile_id"
"custom"
No, if matched by email from profile or subscriptionsProfile matching mode
By default - email
emailstring"john@example.com""matching":"email" - both profile data and subscriptions
"matching":"email_profile" - profile data only
Email address
phonestring"+79000000000""matching":"phone"Phone number
profile_idstring"abcdefghijklmnqrstuvwxyz""matching":"profile_id"Profile ID
field_namestring"CRM_ID""matching":"custom"Custom profile data field name
field_valueint/string"123420""matching":"custom"

Custom profile data field value.

Searching by combination of tags is available for tag type profile fields. Values are recorded as a string: "tag-1, tag-2".

resource_idint24NoResource ID for email and phone matching

Request example

{
"token": "abcdefghijklmnqrstuvwxyz",
"rel_id": 3,
"profile_a": {
"profile_id": "5d63dbdb439e7306b596c5d0"
},
"profile_b": {
"profile_id": "5d441038439e7363f3c26539"
},
"weights": {
"user_like": 2,
"donate": 343,
"is_online": true
}
}

Response example

{
"error": 0,
"error_text": "",
"profile_a": "5c910f6bc484d023b1309bee",
"profile_b": "5c910938c484d023b1309bac",
"relation_id": 1
}

Response parameters

ParameterTypeDescription
errorintError code
error_textstringError description
profile_astringDatabase A profile
profile_bstringDatabase B profile
relation_idintRelation ID