Get Subscriber Usage
This API is used to retrieve a subscriber’s usage summary per given period. The user can choose to retrieve an all-usage summary, or a selective summary filtered per usage type, such as Data only or SMS only.
| HTTP URL | |
|---|---|
| POST | /api/v2/subscriber/{type}/{type}/{value} |
NOTE: All {type} and {value} pairs, define the search criteria. Valid {type} ENUMs are: ‘imsi’, ‘iccid’, ‘msisdn’, ‘imei’.
Eligibility
The Requester is eligible to request and retrieve usage information for own subscribers and his sub-customers’ subscribers.
API Request
Request Structure
|
Parameter |
Type |
M/O/CM |
Description |
|---|---|---|---|
|
fromDate |
Date |
M |
Starting date of usage retrieval Format: YYYY-MM-DD |
|
toDate |
Date |
O |
Ending date of usage retrieval Format: YYYY-MM-DD If empty, then current date [TODAY()] is considered. |
|
service |
String |
O |
Data or SMS. ENUM: DATA, SMS If not provided, return all types |
|
unit |
String |
O |
For Data only Range: KB, MB, GB Default: KB |
API Response
Response Structure
|
Parameter |
Type |
M/O/CM |
Description |
|---|---|---|---|
|
errorCode |
String |
O |
Failure code. |
|
errorMessage |
String |
O |
Failure message. |
|
content |
Object |
O |
Array of main response body object displayed when an API call was successful. For a failure, it will be empty. |
|
pageable |
Object |
O |
Paging information object displayed when an API call was successful. For a failure, it will be empty. |
Content data objects
|
Element |
Type |
M/O/CM |
Description |
|---|---|---|---|
|
subscriberId |
UUID |
M |
Subscriber universal unique identifier |
|
customerId |
UUID |
O |
Indicates the customer ID that the subscriber is connected to. |
|
customerName |
String |
O |
Indicates the customer name that the subscriber is connected to. |
|
usage |
Object |
M |
Array of usage objects |
Usage data objects
|
Element |
Type |
M/O/CM |
Description |
|---|---|---|---|
|
type |
String |
M |
Usage type ENUM: Data, SMS |
|
quantity |
Decimal |
M |
Usage-summary amount |
|
unit |
String |
CM |
Unit measurement Data valid values: KB, MB, GB If not provided, default value KB |
Pageable data objects
|
Element |
Type |
M/O/CM |
Description |
|---|---|---|---|
|
page |
Numeric |
M |
Page number |
|
size |
Numeric |
M |
Page size. Number of requested elements per page |
|
totalPages |
Numeric |
M |
Total amount of available pages per requested page size |
|
totalElements |
Numeric |
M |
Total amount of retrieved elements |
Error Codes
In addition to the general success and failure codes, the following error codes are possible.
|
Code |
Message |
|---|---|
|
GLOBAL_1001 |
Service unavailable. Please try again |
|
SUBSCRIBER_1002 |
Subscriber does not exist |
|
SUBSCRIBER_1006 |
Failed to retrieve subscriber details |
Examples
Request Body
{
"fromDate": "2021-11-25",
"toDate": "2021-11-28",
"service": "DATA",
"unit": "MB"
}
Response Body: Success ACK
{
"errorCode": "",
"errorMessage": "",
"content": [
{
"subscriberId": "d7fcef24-5c03-41dd-9e33-995b7d6f47a4",
"customerId": "e7fcef24-5c03-41dd-9e33-995b7d6f47b5",
"customerName": "Gualas LTD.",
"usage": {
"type": "DATA",
"quantity": 50.5,
"unit": "MB"
}
},
{
"subscriberId": "b5fcee28-5c03-41dd-8e33-895b7d6e67b5",
"customerId": "e7fcef24-5c03-41dd-9e33-995b7d6f47a7",
"customerName": "Gualas LTD.",
"usage": {
"type": "SMS",
"quantity": 100,
"unit": "SMS"
}
}
],
"pageable": {
"page": 0,
"size": 10,
"totalPages": 1,
"totalElements": 1
}
}
Response Body: Failure NAK
{
"errorCode": "SUBSCRIBER_1006",
"errorMessage": "Failed to retrieve subscriber details",
"content": "",
"pageable": ""
}