Customer-statistics method to retreive for a date range

Hi

I would like to call your api for customer-statistics to retrieve the stats. I can make the call successfully but how can I call it for a date range and is this the correct api call to get all stats as per the statistics on the customer view(i.e. the sessions; usage per day; FUP stats).

Thanks

Hi Ryan, there are filters that you can use in API calls. For example you den define the period for statistics.
The description is here - https://splynx.docs.apiary.io/#introduction/search,-order,-limit,-and-offset

Thanks for the response. I am unable to retrieve the stats for an hourly range however or even daily as per your admin tool?

Hi, the stats that are available are sessions statistics.
How often your sessions are closed ? Is it pppoe sessions or it’s Mikrotik API accounting sessions ?
Filter settings allow you to display sessions via API for the period XX.XX.XXXX from to XX.XX.XXXX

I would like to access the statistics hourly, daily, weekly as per your admin console which shows the graphs on the right of the customer statistics.

Graph is shown for statistics per Day if I’m correct.
Daily/hourly and weekly - this is the small FUP counter table. I’m not sure how to get it from api. @ex do you have any idea ?

Hi guys Still no feedback?

For graphs you can use direct RRD file:
/var/www/splynx/system/rrd/db/services / .rrd

https://splynx.docs.apiary.io/#reference/customers/custom-services/customers-statistics
this you can use for per session user statistics.

https://splynx.docs.apiary.io/#reference/fup/fup-counter-collection/list-all-fup-counters
this you can use for FUP statistics.

Usage per day - not available yet for API (already in dev plan and will be available in next updates)

Is usage per day available in splynx API 2.0 ? If so from which URL I can request it?

sure: (small example)

    /**
     * Get list of traffics for internet service.
     *
     * ```php
     * // You may get all traffics with specify service id through url:
     * $params = [
     *      'main_attributes' => ['service_id' => 1]
     * ];
     * $url = 'admin/customers/customer-traffic-counter' . '?' . http_build_query($params);

1 Like

Thank You. It worked.