activation_code_report

To retrieve historical data about activation code actions (assignments, unassignments, and expirations) within a specified time range, use the account/activation_code_report method.

Prerequisites
  • The activation code feature (billing_by_codes) must be enabled for the service.
  • The user must be the creator of a top account or an account with dealer rights.

Endpoint

Copied!
svc=account/activation_code_report&params={
    "timeFrom": <long>,
    "timeTo": <long>
}

Parameters

The request must contain the following parameters:

Parameter Description
timeFrom Start of the time range (Unix timestamp). Must be less than timeTo.
timeTo End of the time range (Unix timestamp). Must be greater than timeFrom.

Response

If the request is completed successfully, the response is returned as an array of objects in the following format:

Copied!
[
    {
        "guid": <text>,      /* Activation code GUID. */
        "uid": <long>,       /* Unit ID. Returns 0 if the code wasn't assigned at the time of the action. */
        "uname": <text>,     /* Unit name. Empty if the code wasn't assigned. */
        "action": <int>,     /* Action type: 0 — assigned, 1 — unassigned, 2 — expired. */
        "acc_id": <long>,    /* Account ID where the unit is created. Returns 0 if no unit was assigned. */
        "acc_name": <text>,  /* Account name. Empty if no unit was assigned. */
        "tmc": <long>,       /* Code creation timestamp (Unix time). */
        "ttl": <long>,       /* Validity period in seconds. */
        "tma": <long>,       /* Activation timestamp, that is, when the code was first assigned to a unit (Unix time). */
        "tme": <long>        /* Estimated expiration timestamp (Unix time). */
    }
]

The data returned depends on the user’s role:

  • Top account user: all activation code actions for the specified time range are returned.
  • Account with dealer rights: only actions linked to units to which the user has the Manage activation codes access right (ADF_ACL_AVL_UNIT_MANAGE_BILLING_CODES) are returned.

If no actions occurred in the specified time range, an empty array is returned.

If the request fails, an error code is returned.

Error codes

Error code Description
4 Invalid input parameters (missing parameters or timeFrom >= timeTo).
5 Error performing request (internal server error).
7 Access denied, because the user doesn’t belong to a service with billing_by_codes enabled, or isn’t an account creator with dealer rights.

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