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-TokenheaderstringRequiredAPI token of a manager that performs the operation (see Viewing and updating Manager's information)
Content-TypeheaderstringRequiredMedia type of the request. Specify the following: application/vnd.api+json
AcceptheaderstringRequired

Supported media types of the answer. Specify the following: application/vnd.api+json

base_urlpathstringRequiredActivePlatform URL
reseller_idpathintegerRequiredID of the reseller for which information about the best Reseller discount is retrieved
current_datequerydateRequiredDate for which information about the best Reseller discount is retrieved (YYYY-MM-DD)

plan_id

query

string

OptionalID of the plan for which information about the best Reseller discount is retrieved
subscription_idquerystringOptionalID of the subscription for which information about the best Reseller discount is retrieved

Response model

Name

Data type

Description

dataobjectResponse data


id

integer

Discount ID

typestringData type

attributesobjectDiscount information


created_at

date

Date and time of discount creation


updated_at

date

Data and time of discount last update


start_atdateStart date of the discount period (YYYY-MM-DD)


finish_atdateEnd date of the discount period (YYYY-MM-DD)


namestringDiscount name


typestringDiscount type


ratestringDiscount percentage from 0 to 100


apply_to_subscriptionbool

Indicates whether the discount is applied to the specified subscription only:

  • true — the discount is applied to the specified subscription only of the specified reseller one level down to the reseller provided the discount (see subscription).
  • false — the discount can be applied to any subscription (taking into account the restrictions) of the specified reseller one level down to the reseller provided the discount.

If all_resellers = true, the discount can be applied to any subscription (taking into account the restrictions)



all_resellersbool

Indicates the discount availability to resellers:

  • true — the discount is available to all resellers one level down to the reseller provided the discount.
  • false — the discount is available only to the specified resellers one level down to the reseller provided the discount (see resellers).


all_plansbool

Indicates the discount availability to plans on the level of the specified resellers:

  • true — the discount is available to all plans on the level of the specified resellers.
  • false — the discount is available only to the specified plans on the level of the specified resellers (see plans).

If all_resellers = true, the discount is always available for all plans



all_accountsbool

Indicates the discount availability to accounts on the level of the specified resellers:

  • true — the discount is available to all accounts on the level of the specified resellers.
  • false — the discount is available only to the specified accounts on the level of the specified resellers (see accounts).

If all_resellers = true, the discount is always available for all accounts



resellersarrayThe list of specified resellers for all_resellers = false


plansarrayThe list of specified plans for all_plans = false


accountsarrayThe list of specified accounts for all_accounts = false


subscriptionintegerID 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": {}
        }
    }
}