Usage Detail
Download usage detail for the SIMs in an account.
Auth Scope
urn:grt:gemmContent-Type
application/jsonBase URL
https://gemmapi2.granitenet.com/v2/api/gemm/v1Uses and Requirements
Use this API to download usage detail for the SIMs in an account. You can download usage for up to 6 billing cycles, including the current one. The API is synchronous and no callback is sent. Because the result can be large, the API returns one page at a time. Use pagingInformation to set the page number and page size.
HTTP Status Codes
| Status | When |
|---|---|
200 | The request succeeded. Usage detail for the matching SIMs is returned one page at a time; if none match, usageDetail is empty. This API is synchronous and no callback is sent. |
400 | Validation failed: parentAccountNumber is missing or not an 8-digit number; accountNumber is not an 8-digit number; iccid is not 19-20 digits (an F is allowed as the 20th character); connection is not 19 to 32 digits; msisdn is not 10 digits; planType is longer than 10 characters; user, model or searchValue is longer than 100 characters; sortingInformation.sortBy is not a sortable column; pageNumber is less than 1 or pageSize is less than 10; the macnum header is missing or not an 8-digit number; or the request body is missing or is not valid JSON (for example cycle is not a date or tags is not an array). |
401 | The bearer token is missing, invalid or expired, or you do not have access to the account in the macnum header. |
403 | You do not have access to parentAccountNumber, parentAccountNumber does not belong to the hierarchy of the macnum header, or your credentials are not enabled for API access. |
429 | Too many requests were sent in a short period. Wait briefly and retry. |
500 | An unexpected server error occurred. |
503 | The system is under scheduled maintenance. Retry after the maintenance window. |
504 | A dependent service did not respond in time. Retry the request. |
Headers
| Header | Value |
|---|---|
Authorization | Bearer access-token |
Content-Type | application/json |
macnum | Top Level Account Number associated with your API credentials. |
Request Body Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
parentAccountNumber | string | Yes | The parent account number whose subscribers' usage detail you want to retrieve. |
planType | string | No | Possible values are
|
planLimit | number | No | Only for internal use. |
cycle | string | No | Billing cycle date in YYYY-MM-DD format. |
accountNumber | string | No | A child account number to retrieve data for that specific child account. |
user | string | No | Device user. |
connection | string | No | 19 to 32 digits. |
msisdn | string | No | 10 digits. |
model | string | No | Device model. |
iccid | string | No | A specific ICCID to filter results to. 19-20 digits; an F is allowed as the 20th character. |
searchValue | string | No | Free-text search value, matched against the connection's account, device and plan fields. |
tags | array of strings | No | Filter results to connections with these tags, for example ["warehouse"]. A plain string is not accepted and returns 400. |
sortingInformation | object | No | Sorting details for the request. If omitted, results are sorted by cycle. |
sortBy | string | No | The column to sort results by, for example Cycle, Iccid or status. An unknown column returns 400 ("SortBy must be one of the sortable overall usage columns."). |
sortDirection | string | No | ASC (default) or DESC. |
pagingInformation | object | No | Paging details for the request. If omitted, page 1 with 10 records is returned. |
pageNumber | number | Yes | Required when pagingInformation is provided. The page to retrieve. The first response returns pageCount inside pagingInformation, which tells you how many pages match your filters. Increment pageNumber on each call to fetch the next page. |
pageSize | number | Yes | Required when pagingInformation is provided. The number of records to retrieve in a single API call. Must be at least 10. Recommended value: 25. |
Request Examples
Responses
Success Response (200 OK)
Response Fields
| Parameter | Type | Description |
|---|---|---|
usageDetail | array | One entry per connection matching the request criteria. |
accountNumber | string | The account number the connection belongs to. |
accountName | string | Name of the account. |
parentAccountNumber | string | The parent account number. |
parentAccountName | string | Name of the parent account. |
iccid | string | The ICCID of the SIM. Not returned for SIM360 accounts, which return connection. |
connection | string | The connection identifier. Returned for SIM360 accounts instead of iccid. |
provider | string | The carrier the SIM is provisioned with. |
msisdn | string | The mobile number of the connection. |
imei | string | The IMEI (equipment ID) of the device. |
planName | string | Name of the rate plan the connection is on. |
planType | string | Individual or Pooled. |
planLimit | number | The usage limit of the plan. Not present when the plan has no fixed limit. |
planUsage | string | Usage recorded for the plan in the billing cycle. |
planUsagePercentage | string | Percentage of the plan limit that has been used. |
simLimit | string | The usage limit assigned to the SIM. Unlimited or N/A when the SIM has no fixed limit. |
simUsage | string | Usage recorded for the SIM in the billing cycle. |
simUsagePercentage | string | Percentage of the SIM limit that has been used. |
username | string | Device user. |
status | string | Current status of the SIM, for example Activated. |
planAlias | string | Alias of the plan. |
simAlias | string | Alias of the SIM. |
cycleDate | string | The start date of the billing cycle. |
cycle | string | The billing cycle the usage belongs to. |
manufacturer | string | Manufacturer of the device. |
model | string | Device model. |
ipType | string | IP type of the connection, for example Dynamic or Static. Prefixed with the network type when one applies. |
ipAddress | string | IP address assigned to the connection. |
subnetMask | string | Subnet mask of the connection. |
defaultGateway | string | Default gateway of the connection. |
cycleDay | string | The day of the month the billing cycle starts. |
location | string | Location of the device. |
modelNumber | string | Model number of the device. |
bundleType | string | Bundle type of the connection. |
equipmentId | string | Equipment ID of the device. |
eqiupmentProduct | string | Equipment product of the device. The field name is spelled as returned by the API. |
customField1 | string | User-defined custom field. |
customField2 | string | User-defined custom field. |
generalLedger | string | General ledger value held against the connection (custom field 3). |
branchNumber | string | Branch number held against the connection (custom field 4). |
employer | string | Employer held against the connection (custom field 5). |
tags | string | Tags assigned to the connection. |
pagingInformation | object | Paging details for the result set. |
pageNumber | integer | The page returned. |
pageSize | integer | The page size used for the request. |
pageCount | integer | Total number of pages available for the given criteria. |
recordCount | integer | Total number of records across all pages. |
Failure Responses
Error Message
Error Response Fields
| Parameter | Type | Description |
|---|---|---|
result | object | Result status object. |
status | string | Result status: success or failure. |
errors | object | List of errors. |
errorCode | string | Error code. |
errorMessage | string | Error message. |
Code Examples
Related Links
Last updated on