Get daily usage


#1

Is there a way to retrieve daily data usage totals via the API?
I’ve tried using the granular API call by submitting daily timestamps:
https://sonar.software/apidoc/#api-Account_Data_Usage-GetAccountDataUsages
but the ‘totals’ it returns at the bottom of the array do not appear to be accurate. Futhermore I have to submit upwards of 30 api calls to get daily usage near the end of a billing cycle which makes the portal page load painfully slow.


#2

That would be the way to do it. If you’re seeing inaccurate data, please shoot it in to support so they can troubleshoot with you.

If you want to display it in real time, I’d recommend just pulling it as a background process once a day and caching it.


#3

Thanks Simon. Here is what I’m seeing…Note the 27GB seems accurate and reflects what the total for the billing period should be, but upon totalling up the days for the billing period via granular method we get 53.89GB.


#4

Troy,

If you can send all the details to support@sonar.software, we can work with you to help figure out where the problem lies.


#5

I’ve been working with your support staff and it appears the API may have an issue as it isn’t returning accurate figures. Hopefully we’ll be able to figure it out quickly. Thanks for your help!


#6

Troy,

Alex should have a solution back to you pretty soon.


#7

@troy did you figure out a better solution?


#8

Alex @ support informed us of the start/end time issue (having to use the same timestamp for both start/end), which mostly fixed the issue though our totals returned via granular query don’t exactly match the total from an aggregate query.

We’re still using a for/while loop to get daily usage which means near the end of the billing cycle the data usage page will load very slow. I know Simon mentioned caching, but I like the customer to be able to see their live data by the minute or hour. I may setup an ajax query so the data usage page will load somewhat normal and then the customer can click a link to open a div to load and display daily usage.


#9

There is no reason to not cache all the prior days though - there’s no way that can change after the fact. You should only ever need to get ‘live’ data for the current day.