Get Things Services Usage Report
This guide will show you how you can get your Things (SIM) Usage Report via an API command.
Please note that in order to get Services Usage Report you will need to run multiple API commands:
post
https://console.monogoto.io
/report-template
Create Report template
curl -X POST \
--url "https://console.monogoto.io/report-template/" \
-H "accept: application/json" \
-H "Authorization: Bearer {YOUR_TOKEN}" \
-d "{ \"Name\": \"{REPORT_NAME}\", \"Description\": \"{REPORT_DESCRIPTION}\", \"GroupBy\": \"servingNetwork\", \"rateByCurrentPricePlan\": true, \"ReportType\": \"rating\", \"ReportPeriod\": { \"startDate\": {START_DATE}, \"endDate\": {END_DATE}}}" \
Example of request
curl -X POST \
--url "https://console.monogoto.io/report-template/" \
-H "accept: application/json" \
-H "Authorization: Bearer eyJhb6IkpXVCJ9.eyJSb2xlIjoiVXN4lclByb2ZpbGVJZF9kZGM2MThhNC0wNTI1LTQ2MmUtYWN3NzhhMGQxYmbSI6Im4zgFkbWluIiwiQ3VzdG9tsbCwiVXNlcklkIjoiVklkXzg5Yj5Y2OGEyUtNDQThhLTEzZjA0MzJhZDE3YyINTAzgZmUtZGI51My00ZjRiLTktN2U5Yjc0ZWU1ZThlIiwiaWNzM3MjI5L2MDY3NTE2Mjl9.99aSLzP7kTgK6TZGW-xalrMu0GkW6viunt3XxbNng" \
-d "{ \"Name\": \"September_report\", \"Description\": \"September_report\", \"GroupBy\": \"servingNetwork\", \"rateByCurrentPricePlan\": true, \"ReportType\": \"rating\", \"ReportPeriod\": { \"startDate\": 1661979600000, \"endDate\": 1664571599000}}" \
Example of response to our request:
ReportTemplateId_a14901d4b-7691-4548-8110-72abcba0be22
post
https://console.monogoto.io
/report-history/{reportTemplateId}
Generate Report using the created template
Please note that this API may take a while to be completed if you have a lot of Things (SIM) in your Monogoto account.
curl -X POST \
--url "https://console.monogoto.io/report-history/{REPORT_TEMPLATE_ID}" \
-H "accept: application/json" \
-H "Authorization: Bearer {YOUR_TOKEN}" \
Example of request
curl -X POST \
--url "https://console.monogoto.io/report-history/ReportTemplateId_a14901d4b-7691-4548-8110-72abcba0be22" \
-H "accept: application/json" \
-H "Authorization: Bearer eyJhb6IkpXVCJ9.eyJSb2xlIjoiVXN4lclByb2ZpbGVJZF9kZGM2MThhNC0wNTI1LTQ2MmUtYWN3NzhhMGQxYmbSI6Im4zgFkbWluIiwiQ3VzdG9tsbCwiVXNlcklkIjoiVklkXzg5Yj5Y2OGEyUtNDQThhLTEzZjA0MzJhZDE3YyINTAzgZmUtZGI51My00ZjRiLTktN2U5Yjc0ZWU1ZThlIiwiaWNzM3MjI5L2MDY3NTE2Mjl9.99aSLzP7kTgK6TZGW-xalrMu0GkW6viunt3XxbNng" \
Example of response to our request:
ReportHistoryId_611bac7b-abc9-4c18-9cbb-a497889180b7
get
https://console.monogoto.io
/report-history/byTemplate
Get CSV Report location
curl -X GET \
--url "https://console.monogoto.io/report-history/report-history/byTemplate" \
-H "accept: application/json" \
-H "Authorization: Bearer {YOUR_TOKEN}" \
Example of request
curl -X GET \
--url "https://console.monogoto.io/report-history/report-history/byTemplate" \
-H "accept: application/json" \
-H "Authorization: Bearer eyJhb6IkpXVCJ9.eyJSb2xlIjoiVXN4lclByb2ZpbGVJZF9kZGM2MThhNC0wNTI1LTQ2MmUtYWN3NzhhMGQxYmbSI6Im4zgFkbWluIiwiQ3VzdG9tsbCwiVXNlcklkIjoiVklkXzg5Yj5Y2OGEyUtNDQThhLTEzZjA0MzJhZDE3YyINTAzgZmUtZGI51My00ZjRiLTktN2U5Yjc0ZWU1ZThlIiwiaWNzM3MjI5L2MDY3NTE2Mjl9.99aSLzP7kTgK6TZGW-xalrMu0GkW6viunt3XxbNng" \
In the response to our request, you will need to find a Report matching our Report template ID or Report history ID. Then take csvPath and use it in the 4th API command.
Example of response to our request:
{
"dbResponse": [
{
"ReportHistoryId": "ReportHistoryId_611bac7b-abc9-4c18-9cbb-a497889180b7",
"ReportTemplateId": "ReportTemplateId_a14901d4b-7691-4548-8110-72abcba0be22",
"ReportType": "rating",
"FilterBy": "none",
"FilterByItems": {},
"OrganizationId": "OrganizationId_2ds578d7d-abc9-4123-acbb-1ec67a98b01a",
"CustomerId": "cid_eb426486-488a-4f44-9c6d-3627a66150cb",
"GroupBy": "servingNetwork",
"GroupByInterval": "d",
"ReportTemplateName": "September_report",
"ReportTemplateDescription": "September_report",
"ReportPeriod": {
"startDate": 1661979600000,
"endDate": 1664571599000
},
"csvPath": "/efs/reports/csv/2022/10/4/Report_September_report_#8d351.csv",
"pdfPath": "/efs/reports/pdf/2022/10/4/Report_September_report_#8d351.pdf",
"ReportData": null,
"Name": "Report September_report #8d351",
"rateByCurrentPricePlan": false,
"Type": "ReportHistory",
"DateCreated": 1664887341012
}
get
https://console.monogoto.io
/report-history/downloadReport/csv/{csvPath}
Download CSV Report information
curl -X GET \
--url "https://console.monogoto.io/https://console.monogoto.io /report-history/downloadReport/csv/{csvPath}" \
-H "accept: application/json" \
-H "Authorization: Bearer {YOUR_TOKEN}" \
Please note that in csvPath some symbols will need to be converted to numbers and letters:
/ - will be need to be replaced with %2F
# - will need to be replaced with %23
Example of csvPath:
/efs/reports/csv/2022/10/4/Report_September_report_#8d351.csv
Example after csvPath symbols were changed to code values:
%2Fefs%2Freports%2Fcsv%2F2022%2F10%2F4%2FReport_September_report_%238d351.csv
Example of request
curl -X GET \
--url "https://console.monogoto.io/https://console.monogoto.io /report-history/downloadReport/csv/%2Fefs%2Freports%2Fcsv%2F2022%2F10%2F4%2FReport_September_report_%238d351.csv" \
-H "accept: application/json" \
-H "Authorization: Bearer eyJhb6IkpXVCJ9.eyJSb2xlIjoiVXN4lclByb2ZpbGVJZF9kZGM2MThhNC0wNTI1LTQ2MmUtYWN3NzhhMGQxYmbSI6Im4zgFkbWluIiwiQ3VzdG9tsbCwiVXNlcklkIjoiVklkXzg5Yj5Y2OGEyUtNDQThhLTEzZjA0MzJhZDE3YyINTAzgZmUtZGI51My00ZjRiLTktN2U5Yjc0ZWU1ZThlIiwiaWNzM3MjI5L2MDY3NTE2Mjl9.99aSLzP7kTgK6TZGW-xalrMu0GkW6viunt3XxbNng" \
Example of response to our request showing CSV file information:
Thing Name,IMSI,MSISDN,Roaming Partner,Data,SMS,MO SMS,MT SMS,Voice,MO VOICE,MT VOICE,Total Before Credit,Credit,Total
"ICCID 8912372646888991, 8912372646888991",1234567891011,+420123456789,Bite , 140.25 MB,,,,,,,,,0.9677
"ICCID 8912372646888991, 8912372646888991",1234567891011,+420123456789,,140.25 MB,,,,,,,0.9677,0.0000,0.9677
"ICCID 8912372646888992, 8912372646888992",1234567891012,+420123456790,OMNITEL , 64.34 MB,,,,,,,,,0.4504
"ICCID 8912372646888992, 8912372646888992",1234567891012,+420123456790,,64.34 MB,,,,,,,0.4504,0.0000,0.4504
"ICCID 8912372646888993, 8912372646888993",1234567891013,+420123456791,Bite , 28.9 MB, 2,,,,,,,,0.1994
"ICCID 8912372646888993, 8912372646888993",1234567891013,+420123456791,,28.9 MB,,,2,,,,0.1994,0.0000,0.1994
Last modified 11mo ago