Usage
Usage#
Introduction#
This document details all the APIs that show the data usage of mobile devices on your account.
All data usage is shown in bytes.
API Index#
APIs#
Get an Account's data usage#
Required Authentication Level: basic
GET http://{SERVER}:{PORT}/v2/accounts/{ACCOUNT_ID}/usage
curl -v -X GET \
-H "X-Auth-Token: {AUTH_TOKEN}" \
-H "X-Kazoo-Cluster-ID: {CLUSTER_ID}" \
http://{SERVER}:{PORT}/v2/accounts/{ACCOUNT_ID}/usage
{
"auth_token": "{AUTH_TOKEN}",
"data": {
"from": "201611",
"to": "201611",
"total": 187994323,
"per_mdn": {
"+15550123456": 162324323,
"+15556541490": 25670000
}
},
"request_id": "{REQUEST_ID}",
"status": "success"
}
Optional query string parameters:
Key | Value | Description |
---|---|---|
from | YYYYMM ("201610") |
Choose the starting month for the usage report. Defaults to the current month. |
to | YYYYMM |
Choose the last month for the usage report. Defaults to the current month. If this is set to a month anterior to the from parameter, the from parameter will be overriden by this value. |
month | YYYYMM |
Choose a single month for the usage report. This will override both the from and to parameters. |
Alternatively, the URL http://{SERVER}:{PORT}/v2/accounts/{ACCOUNT_ID}/usage/{MONTH}
can be used to get a usage report for a single month.
Note: When one or more of the requested months do not have any data usage, they will be listed in the empty_months
array.
"empty_months": [
"201610",
"201612"
]
Get an Account's data usage as CSV#
Required Authentication Level: basic
GET http://{SERVER}:{PORT}/v2/accounts/{ACCOUNT_ID}/usage/{MONTH}/csv
curl -v -X GET \
-H "X-Auth-Token: {AUTH_TOKEN}" \
-H "X-Kazoo-Cluster-ID: {CLUSTER_ID}" \
http://{SERVER}:{PORT}/v2/accounts/{ACCOUNT_ID}/usage/{MONTH}/csv
"Usage Report"
"From Date","Nov 1st, 2016","To Date","Nov 30th, 2016"
Summary,Quantity,Unit
Data,187994323,Byte
"Device Name","Current MDN","Device ID","Data Used"
"Device01",+15550000111,11111111111111,0
"Device02",+15550000222,22222222222222,0
"Device03",+15550000333,33333333333333,162324323
"Device04",+15550000444,44444444444444,0
"Device05",+15550000555,55555555555555,25670000
Alternatively, the URL http://{SERVER}:{PORT}/v2/accounts/{ACCOUNT_ID}/usage/csv
can be used to get a CSV usage report for the current month. A specific month may then be specified via the month
query string parameter.
Get a Device's data usage#
Required Authentication Level: basic
GET http://{SERVER}:{PORT}/v2/accounts/{ACCOUNT_ID}/devices/{DEVICE_ID}/usage
curl -v -X GET \
-H "X-Auth-Token: {AUTH_TOKEN}" \
-H "X-Kazoo-Cluster-ID: {CLUSTER_ID}" \
http://{SERVER}:{PORT}/v2/accounts/{ACCOUNT_ID}/devices/{DEVICE_ID}/usage
{
"auth_token": "{AUTH_TOKEN}",
"data": {
"from": "201611",
"to": "201611",
"total": 162324323,
"hourly": [
{
"timestamp": 63646434000,
"usage": 13450
},
{
"timestamp": 63646437600,
"usage": 161503418
},
{
"timestamp": 63646441200,
"usage": 29412
},
...
]
},
"request_id": "{REQUEST_ID}",
"status": "success"
}
Optional query string parameters:
Key | Value | Description |
---|---|---|
from | YYYYMM ("201610") |
Choose the starting month for the usage report. Defaults to the current month. |
to | YYYYMM |
Choose the last month for the usage report. Defaults to the current month. If this is set to a month anterior to the from parameter, the from parameter will be overriden by this value. |
month | YYYYMM |
Choose a single month for the usage report. This will override both the from and to parameters. |
Alternatively, the URL http://{SERVER}:{PORT}/v2/accounts/{ACCOUNT_ID}/devices/{DEVICE_ID}/usage/{MONTH}
can be used to get a usage report for a single month.
Note: When one or more of the requested months do not have any data usage, they will be listed in the empty_months
array.
"empty_months": [
"201610",
"201612"
]