Get best reseller discount
The Get best reseller discount method is used for getting information about the best discount of the Reseller type (see Managing discounts) among all discounts provided by the upstream reseller to the current reseller or any of its downstream resellers. The best discount has the maximum percentage among other available discounts under the specified conditions.
Information about the best Reseller discount is retrieved for the specified date and can take into account the discount restrictions by the specified ID of a plan or subscription (for more information about Reseller discounts, see Managing Reseller discounts):
- If the request does not include any optional arguments, only discounts without restrictions by subscription, plan, and account are considered.
- If the request includes the plan ID, only discounts without restrictions by subscription and account are considered.
- If the request includes the subscription ID, discounts with restrictions by subscription, plan, and account are considered.
The discount amount is calculated when the reseller charges are closed: when the end-customer charges are closed or on the billing day.
Information about the best Reseller discount does not guarantee that the discount will be applied:
- When the billing period is closed, the reseller may have another discount that will be considered the best.
- The period of the current best discount may end before the moment when the billing period is closed.
An API token of a manager is required for authorization. To get an API token via the Operator Control Panel, see Viewing and updating manager's information.
The manager's API token specified in an API request determines:
- The role and access level of the manager, which determine the availability of a method.
- The current reseller and downstream resellers accessible within a method.
GET {base_url}/api/v3/resellers/{reseller_id}/reseller_discounts
Arguments
Name | Parameter Type | Data type | Required/Optional | Description |
---|---|---|---|---|
X-Api-Token | header | string | Required | API token of a manager that performs the operation (see Viewing and updating manager's information) |
Content-Type | header | string | Required | Media type of the request. Specify the following: application/vnd.api+json |
Accept | header | string | Required | Supported media types of the answer. Specify the following: application/vnd.api+json |
base_url | path | string | Required | ActivePlatform URL |
reseller_id | path | integer | Required | ID of the reseller for which information about the best Reseller discount is retrieved |
current_date | query | date | Required | Date for which information about the best Reseller discount is retrieved (YYYY-MM-DD) |
plan_id | query | string | Optional | ID of the plan for which information about the best Reseller discount is retrieved |
subscription_id | query | string | Optional | ID of the subscription for which information about the best Reseller discount is retrieved |
Response model
Name | Data type | Description | ||||
---|---|---|---|---|---|---|
data | object | Response data | ||||
id | integer | Discount ID | ||||
type | string | Data type | ||||
attributes | object | Discount information | ||||
created_at | date | Date and time of discount creation | ||||
updated_at | date | Data and time of discount last update | ||||
start_at | date | Start date of the discount period (YYYY-MM-DD) | ||||
finish_at | date | End date of the discount period (YYYY-MM-DD) | ||||
name | string | Discount name | ||||
type | string | Discount type | ||||
rate | string | Discount percentage from 0 to 100 | ||||
apply_to_subscription | bool | Indicates whether the discount is applied to the specified subscription only:
If | ||||
all_resellers | bool | Indicates the discount availability to resellers:
| ||||
all_plans | bool | Indicates the discount availability to plans on the level of the specified resellers:
If | ||||
all_accounts | bool | Indicates the discount availability to accounts on the level of the specified resellers:
If | ||||
resellers | array | The list of specified resellers for all_resellers = false | ||||
plans | array | The list of specified plans for all_plans = false | ||||
accounts | array | The list of specified accounts for all_accounts = false | ||||
subscription | integer | ID of the specified subscription of the specified reseller for apply_to_subscription = true |
Request example
GET /api/v3/resellers/389/reseller_discounts?current_date=2021-03-04
Host: test.activeplatform.com
Content-Type: application/vnd.api+json
X-Api-Token: vY5fwetestK3gJXZH5uHCw
Accept: application/vnd.api+json
Response example
{
"data": {
"id": "128",
"type": "discounts",
"attributes": {
"created_at": "2021-03-02T17:20:57.715+03:00",
"updated_at": "2021-03-03T16:47:02.958+03:00",
"start_at": "2021-03-02",
"finish_at": "2021-03-30",
"name": "10per",
"type": "reseller",
"rate": "10.0",
"apply_to_subscription": false,
"all_resellers": true,
"all_plans": true,
"all_accounts": true,
"resellers": [],
"plans": [],
"accounts": [],
"subscription": {}
}
}
}