Skip to main content

Get tariffs

Returns the active tariffs of the server. A tariff code is required to create a device: pass it in the tariff_code field of create_device_req. To change the tariff of a device, use update_device_req. The list is the same for all clients of the server.

Request and response: get_tariffs_req → get_tariffs_resp.
Access: a token of any access level.

Current ONS version

The server does not return error code 2 (Unexpected error).

Request​

Fields not marked as required may be omitted.

FieldTypeDescription
cmdstringget_tariffs_req
operation_idstringAny string; the server returns it in the response to match the request and the response
{
"cmd": "get_tariffs_req",
"operation_id": "cdma"
}

Response​

FieldTypeDescription
cmdstringget_tariffs_resp
operation_idstringValue from the request
statusuint81 — success, 2 — error
tariffsarrayTariffs: name — name, code — code for tariff_code, description — description, may be empty
error_code, error_textuint8, stringOnly on error, see below
{
"cmd": "get_tariffs_resp",
"operation_id": "cdma",
"status": 1,
"tariffs": [
{
"name": "Tariff 1",
"code": "A1",
"description": ""
},
{
"name": "Tariff 2",
"code": "A2",
"description": ""
}
]
}

Errors​

error_codeerror_textWhat happened
1Tariffs not foundThe server has no active tariffs, or it could not read them from the database

See also​