For the complete documentation index, see llms.txt. This page is also available as Markdown.

Tracker tariff

Which tariff a device is on, and the rules governing a change to another.

These operations read the tariffs a device may switch to, and perform the switch.

A change is heavily constrained, and tariff/tracker/list exists so a caller can find out what is actually permitted rather than guessing. A user may move a tracker from tariff t1 to tariff t2 only when all of the following hold:

  1. The tracker belongs to the user and is not a clone.

  2. The tracker's tariff was last changed more than tariff.freeze.period ago, 30 days by default.

  3. t1.tariff_id differs from t2.tariff_id, so the new tariff is genuinely a different one.

  4. t1.dealer_id and t2.dealer_id both equal the user's effective dealer.

  5. t2.active is 1, meaning the dealer has allowed users to switch to it themselves.

  6. t1.grouping equals t2.grouping, so the change stays inside one group of tariffs.

  7. t2.device is tracker, so the new tariff is one for trackers.

  8. The new tariff is available to the user's legal type. See Tariff (plan).

The effective dealer is the user's own dealer when its dealer_id equals the configured defaultDealerId, or when its dogovor_type is paas. Otherwise it is that dealer's parent.

API actions

API base path: /tariff/tracker.

Operations that list no errors of their own return only the general error codes.


Required sub-user rights: admin (available only to master users).

Change tracker plan

post
/tariff/tracker/change

Move a tracker from its current plan to the plan given by tariff_id.

The change is allowed only when all of the following hold: the tracker belongs to the user and is not a clone; the last change was more than the freeze period ago, 30 days by default; the new plan differs from the current one; both plans belong to the user's effective dealer; the new plan is active; both plans are in the same group; the new plan is for trackers; and the new plan is available to the user's legal type.

When the last change was too recent but the current plan has an early_change_price, the change proceeds and that price is charged. Without one it fails with error 240.

Master users only. A sub-user gets error 13, which the published error list does not mention.

Also accepts GET with the same parameters as query-string values.

Requires the admin right.

Authorizations
AuthorizationstringRequired

Either a user session hash or an API key, with the "NVX " prefix, for example "NVX 22eac1c27af4be7b9d04da2ce1af111b". Obtain a session hash from the userAuth operation, or create an API key from the API keys operations. A small number of operations accept a session hash only and reject an API key with error code 4; each says so in its description.

Body
tracker_idinteger · min: 1Required

ID of the tracker, also known as the object ID. Must belong to the current account. A blocked tracker is accepted here, unlike most operations taking a tracker ID.

tariff_idinteger · min: 1Required

ID of the new plan.

Responses
200

Plan changed

application/json
successbooleanRead-onlyOptional

true if request finished successfully.

Example: true
post/tariff/tracker/change
POST /v2/tariff/tracker/change HTTP/1.1
Host: api.eu.navixy.com
Authorization: YOUR_API_KEY
Content-Type: application/json
Accept: */*
Content-Length: 30

{
  "tracker_id": 1,
  "tariff_id": 1
}
{
  "success": true
}

Errors

These errors come in addition to the general error codes:

  • 201 - Not found in the database - if user doesn't have trackers with given tracker_id.

  • 219 - Not allowed for clones of the device.

  • 237 - Invalid plan - if there are no plan with specified tariff_id and belongs to user's effective dealer.

  • 221 - Device limit exceeded - when new plan limit for devices is less than the current count of devices in the account.

  • 238 - Changing plan is not allowed - user can't switch tracker to that plan.

  • 239 - New plan doesn't exist.

  • 240 - Not allowed changing plan too frequently - plan last changed less or equal to 30 days (tariff.freeze.period config option).


Lists the plans a tracker can switch to, even when the plan was last changed less than tariff.freeze.period ago.

List plans for tracker

post
/tariff/tracker/list

List the plans the given tracker can be switched to, together with the wait until the next free change.

The list is returned even when the last change was less than the freeze period ago; days_to_next_change is what tells you whether a change is free yet.

Also accepts GET with the same parameters as query-string values.

Authorizations
AuthorizationstringRequired

Either a user session hash or an API key, with the "NVX " prefix, for example "NVX 22eac1c27af4be7b9d04da2ce1af111b". Obtain a session hash from the userAuth operation, or create an API key from the API keys operations. A small number of operations accept a session hash only and reject an API key with error code 4; each says so in its description.

Body
tracker_idinteger · min: 1Required

ID of the tracker, also known as the object ID. Must belong to the current account. A blocked tracker is accepted here, unlike most operations taking a tracker ID.

Responses
200

Plans available for the tracker

application/json
successbooleanRead-onlyOptional

true if request finished successfully.

Example: true
days_to_next_changeintegerOptional

Days until the next free change, or 0 when a free change is available now.

post/tariff/tracker/list
POST /v2/tariff/tracker/list HTTP/1.1
Host: api.eu.navixy.com
Authorization: YOUR_API_KEY
Content-Type: application/json
Accept: */*
Content-Length: 16

{
  "tracker_id": 1
}
{
  "success": true,
  "list": [
    {
      "id": 1,
      "name": "text",
      "group_id": 1,
      "active": true,
      "type": "monthly",
      "price": 1,
      "early_change_price": 1,
      "device_limit": 1,
      "has_reports": true,
      "paas_free": true,
      "store_period": "text",
      "auto_prolong": true,
      "features": [
        "api"
      ],
      "map_filter": {
        "exclusion": true,
        "values": [
          "text"
        ]
      }
    }
  ],
  "days_to_next_change": 1
}

Last updated

Was this helpful?