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.
| Field | Type | Description |
|---|---|---|
cmd | string | get_tariffs_req |
operation_id | string | Any string; the server returns it in the response to match the request and the response |
{
"cmd": "get_tariffs_req",
"operation_id": "cdma"
}
Response
| Field | Type | Description |
|---|---|---|
cmd | string | get_tariffs_resp |
operation_id | string | Value from the request |
status | uint8 | 1 — success, 2 — error |
tariffs | array | Tariffs: name — name, code — code for tariff_code, description — description, may be empty |
error_code, error_text | uint8, string | Only 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_code | error_text | What happened |
|---|---|---|
| 1 | Tariffs not found | The server has no active tariffs, or it could not read them from the database |
See also
create_device_req— create a device with a tariff.update_device_req— change the tariff of a device.