The function is intended for creating or editing a referral program.
Data modification:
Parameters:
sok — the parameter value must be non-empty, usually ok;
Result: successful operation or an error message.
Request parameters:
Parameter
Description
func
Function name: referralprogram.edit.
sok
Form submission confirmation. Usually takes the value ok.
out
Response format. Default is bjson.
project
Provider under which this referral program is active.
name
Name of the referral program displayed to the client.
promocode
Promocode template. Use @ID@ in the position where the partner’s ID should be inserted. If a referral enters a promocode matching this template, the client will be credited to the partner.
start_date
The referral program will start generating rewards for expenses created after this date.
end_date
The referral program will generate rewards for expenses created before this date.
assign_by_default
If specified, the referral program will be automatically assigned to a client upon becoming the customer of the provider. Only one referral program can be assigned by default.
url
Provider’s website URL. Each partner will have a unique link. The client’s ID will be appended to this URL.
account_group
Client group for which participation in the referral program is available. Value restrict: prohibit participation for members of the group.
account_group_restrict
Group whose clients will not receive rewards under the referral program.
Example response for successful execution (code 200):
The function is intended for editing an existing referral program.
Data modification:
Parameters:
sok — the parameter value must be non-empty, usually ok;
elid — unique identifier of the referral program being edited;
Result: successful operation or an error message.
Request parameters:
Parameter
Description
func
Function name: referralprogram.edit.
sok
Form submission confirmation. Usually takes the value ok.
elid
Unique identifier of the referral program.
out
Response format. Default is bjson.
project
Provider under which this referral program is active.
name
Name of the referral program displayed to the client.
promocode
Promocode template. Use @ID@ in the position where the partner’s ID should be inserted. If a referral enters a promocode matching this template, the client will be credited to the partner.
start_date
The referral program will start generating rewards for expenses created after this date.
end_date
The referral program will generate rewards for expenses created before this date.
assign_by_default
If specified, the referral program will be automatically assigned to a client upon becoming the customer of the provider. Only one referral program can be assigned by default.
url
Provider’s website URL. Each partner will have a unique link: the client’s ID will be appended to this URL.
account_group
Client group for which participation in the referral program is available. Value restrict: prohibit participation for members of the group.
account_group_restrict
Group whose clients will not receive rewards under the referral program.
Example response for successful execution (code 200):
{
"func": "referralprogram.edit",
"ok": true
}
referralprogram.delete
Access level: user
The function is intended for deleting an existing referral program.
Data modification:
Parameters:
elid — unique identifier of the referral program to be deleted.
Result: successful operation or an error message.
Request parameters:
Parameter
Description
func
Function name: referralprogram.delete.
elid
Unique identifier of the item (referral program).
out
Response format. Default is bjson.
Example response for successful execution (code 200):
{
"func": "referralprogram.delete",
"ok": true
}
referralprogram.rule
Access level: user
The function provides a list of rules associated with the specified referral program.
Data retrieval:
Result: list of referral program rules in bjson format.
Request parameters:
Parameter
Description
elid
Unique identifier of the referral program.
out
Response format. Default is bjson.
Example response for successful execution (code 200):
The function is intended for creating a new condition within a referral program rule.
Data modification:
Parameters:
sok — the parameter value must be non-empty, usually ok;
plid — unique identifier of the parent referral program.
Result: successful operation or an error message.
Request parameters:
Parameter
Description
func
Function name: referralprogram.rule.condition.edit.
sok
Form submission confirmation. Usually takes the value ok.
plid
Unique identifier of the parent item (referral program).
out
Response format. Default is bjson.
ctype
Referral program condition:
0 — no conditions;
1 — referral’s sales volume;
2 — number of services purchased by the referral;
3 — number of referrals brought by the referrer;
4 — total sales volume of all referrals.
orderperiods
Period of the referral’s service orders.
comparison
Comparison operator (e.g., "greater than", "less than or equal to", etc.). Specific values depend on the condition context.
amount_ctype_1
Total amount of the referral’s expenses during the period defined by the referral program rule schedule.
amount_ctype_4
Total amount of all referrals’ expenses during the period defined by the referral program rule schedule.
item_count
Number of services purchased by the referral throughout the entire duration of the referral program.
referral_count
Total number of the referrer’s referrals at the current moment.
group
You can group conditions. Conditions within a group are combined with the OR operator. Groups themselves are combined with the AND operator. Example: conditions A, B, and C belong to one group, and D and E to another. The resulting expression: (A OR B OR C) AND (D OR E).
The parameter accepts one of the following values:
none — no group;
new — create a new condition group.
groupname
Enter the name of the condition group.
Example response for successful execution (code 200):
The function is intended for creating a new condition within a referral program rule.
Data modification:
Parameters:
sok — the parameter value must be non-empty, usually ok;
plid — unique identifier of the parent referral program.
Result: successful operation or an error message.
Request parameters:
Parameter
Description
func
Function name: referralprogram.rule.condition.edit.
sok
Form submission confirmation. Usually takes the value ok.
plid
Unique identifier of the parent item (referral program).
out
Response format. Default is bjson.
ctype
Referral program condition:
0 — no conditions;
1 — referral’s sales volume;
2 — number of services purchased by the referral;
3 — number of referrals brought by the referrer;
4 — total sales volume of all referrals.
orderperiods
Period of the referral’s service orders.
comparison
Comparison operator (e.g., "greater than", "less than or equal to", etc.). Specific values depend on the condition context.
amount_ctype_1
Total amount of the referral’s expenses during the period defined by the referral program rule schedule.
amount_ctype_4
Total amount of all referrals’ expenses during the period defined by the referral program rule schedule.
item_count
Number of services purchased by the referral throughout the entire duration of the referral program.
referral_count
Total number of the referrer’s referrals at the current moment.
group
You can group conditions. Conditions within a group are combined with the OR operator. Groups themselves are combined with the AND operator. Example: conditions A, B, and C belong to one group, and D and E to another. The resulting expression: (A OR B OR C) AND (D OR E).
none — no group;
new — create a new condition group.
groupname
Enter the name of the condition group.
Example response for successful execution (code 200):
The function is intended for editing an existing condition within a referral program rule.
Data modification:
Parameters:
sok — the parameter value must be non-empty, usually ok;
plid — unique identifier of the parent referral program;
elid — unique identifier of the condition being edited.
Result: successful operation or an error message.
Request parameters:
Parameter
Description
func
Function name: referralprogram.rule.condition.edit.
sok
Form submission confirmation. Usually takes the value ok.
plid
Unique identifier of the parent item (referral program).
elid
Unique identifier of the item (condition being edited).
out
Response format. Default is bjson.
ctype
Referral program condition:
0 — no conditions;
1 — referral’s sales volume;
2 — number of services purchased by the referral;
3 — number of referrals brought by the referrer;
4 — total sales volume of all referrals.
orderperiods
Period of the referral’s service orders.
comparison
Comparison operator (e.g., "greater than", "less than or equal to", etc.). Specific values depend on the condition context.
amount_ctype_1
Total amount of the referral’s expenses during the period defined by the referral program rule schedule.
amount_ctype_4
Total amount of all referrals’ expenses during the period defined by the referral program rule schedule.
item_count
Number of services purchased by the referral throughout the entire duration of the referral program.
referral_count
Total number of the referrer’s referrals at the current moment.
group
You can group conditions. Conditions within a group are combined with the OR operator. Groups themselves are combined with the AND operator. Example: conditions A, B, and C belong to one group, and D and E to another. The resulting expression: (A OR B OR C) AND (D OR E).
none — no group;
new — create a new condition group.
groupname
Enter the name of the condition group.
Example response for successful execution (code 200):