get_account_data

To get information about the settings of the account you are currently signed in and its billing plan (billing plan name, balance, days left, available services), use the core/get_account_data method:

Copied!
svc=core/get_account_data&params={
    "type": <int>,
}

Parameters

The request must contain the type parameter with one of the following values:

  • 1, to get basic information required to estimate the state of the user who is currently signed in.
  • 2, to get detailed information with combined, personal and billing plan settings.

Response

If the request is completed successfully, the response contains either basic or detailed information, depending on the value of the type parameter.

Basic information:

Copied!
{
    "parentAccountName": <text>, /* Parent account name. */
    "parentAccountId": <long>, /* Parent account GUID. */
    "parentEnabled": <int>,    /* Shows whether the parent account is enabled. */
    "plan": <text>,            /* Billing plan name. */
    "enabled": <int>,      /* Account state: 0 — blocked, 1 — active. */
    "switchTime": <int>,       /*  Last time of changing the "​enabled" parameter.​  */
    "created": <uint>,       /*  Creation time (UNIX time).​  */
    "flags": <uint>,           /* Billing plan flags. */
    "balance": <text>,     /* Balance (with currency). */
    "daysCounter": <int>,      /* Day counter. */
    "services": {            /* List of services.*/
        <text>: {          /* Service name. */
            "type": <int>,     /* Type: 1 — on demand; 2 — periodic. */
            "usage": <uint>,       /* Quantity of active resources in which the service is used. */
            "maxUsage": <int>, /* Maximum quantity of resources. */
            "cost": <text>, /* Cost table. */
            "interval": <int>, /* Reset interval: 0 — none, 1 — hourly, 2 — daily, 3 — weekly, 4 — monthly. */
            "descr": <text> /* Description. */
        },
        ...
    },
    "dealerRights": <int>,     /* Allow using dealer rights for this billing plan: 0 — no, 1 — yes */
    "subPlans":[<text>]       /* Array of subplans. */
}

Detailed information:

Copied!
{
    "parentAccountName": <text>, /* Parent account name. */
    "parentAccountId": <long>, /* Parent account GUID. */
    "parentEnabled": <int>,    /* Shows whether the parent account is enabled. */
    "plan": <text>,            /* Billing plan name. */
    "enabled": <int>,      /* Account state: 0 — blocked, 1 — active. */
    "switchTime": <int>        /* Last time of changing the "​enabled" parameter​ */
    "flags": <uint>,           /* Duplicates the same flags from the billing plan settings (see the "plan" field below). */
    "balance": <text>,     /* Balance (with currency). */
    "daysCounter": <int>,      /* Day counter. */
    "settings": {           
        "balance": <double>,       /* Balance. */
        "plan":{            /* Billing plan settings. */
            "flags": <uint>,       /* Billing plan flags. */
            "blockBalance": <int>, /* Block balance. */
            "denyBalance": <int>,  /* Minimum balance required for the paid services to be available. */
            "minDaysCounter": <int>,   /* Minimum number of days required for the account to be enabled. */
            "historyPeriod": <int>,    /* History period during which unit messages are stored, in days (if 0 is specified here, the storage period is unlimited). */
            "currencyFormat": <text>,  /* Currency format. */
            "services": {        /* List of services. */
                <text>: {      /* Name. */
                    "type": <int>,     /* Type: 1 — on demand; 2 — periodic. */
                    "usage": <uint>,       /* Number of used items of this type. */
                    "maxUsage": <int>  /* Maximum allowed number of items of this type. */
                    "cost": <text>,        /* Cost table. */
                    "interval": <int>, /* Reset interval: 0 — none, 1 — hourly, 2 — daily, 3 — weekly, 4 — monthly. */
                    "descr": <text>        /* Description. */
                },
                ...
            }
        },
        "personal": {            /* Account settings. */
            ...         /* In the same format as the billing plan settings. */
        },
        "combined": {            /* Combined settings (settings related to the billing plan and account). */
            ...         /* In the same format as the billing plan settings */
        }
    },
    "siteAccess": {
            "<service_name>":"<dns_name>",      /* Where the key is a service name and the value is a DNS name. */
            ...
    },
    "dealerRights": <int>, /* Allow using dealer rights for this billing plan: 0 — no, 1 — yes */
    "subPlans": [<text>]   /* Array of subplans. */
}

You can find available values of billing plan and account flags, as well as the list of services on the account/get_account_data page.

For further information about the structure of account and billing plan settings, see account/update_billing_plan.

If the request fails, error code 4 is returned, indicating one of the following issues:

  • the input parameters are wrong,
  • failed to fetch the user.

If you find a mistake in the text, please select it and press Ctrl+Enter.

Report a mistake

Your message was sent. Thank you!

An error occurred while submitting the form

Download PDF file
Download Word document

See also