MOR API aggregate get

From Kolmisoft Wiki
Jump to navigationJump to search

Description

MOR API for getting aggregate statistics.

Allowed users:

Admin

Reseller Pro

Accountant with Data->Stats permission

Usage

  • MOR call: /api/aggregate_get
  • Methods: POST, GET(if allowed, not recomended)



Parameters

  • u - username to login. Required.
  • hash – SHA1 hash constructed using API Secret Key ( More described in Constructing hash). Required.
  • from - Date from which queues log start. If not used, this parameter will be set to today's date 00:00:00. Date should be entered in Unix time stamp (Epoch) format.
  • till - Date when queues log end. If not used, this parameter will be set to today's date 23:59:59. Date should be entered in Unix time stamp (Epoch) format.
  • a_currency – currency code, by default usd.
  • group_by_user – group by user possible values [0,1]. (Default: 0).
  • group_by_device – group by device possible values [0,1]. (Default: 0).
  • group_by_terminator – group by terminator possible values [0,1]. (Default: 0).
  • group_by_provider – group by termination point possible values [0,1]. (Default: 0).
  • group_by_dst_group – group by destination group possible values [0,1]. (Default: 0).
  • group_by_dst – group by destination possible values [0,1]. (Default: 0).
  • group_by_day – group by day possible values [0,1]. (Default: 0).
  • group_by_hour – group by hour possible values [0,1]. (Default: 0).
  • group_by_user_rate – group by user rate possible values [0,1]. (Default: 0).
  • group_by_provider_rate – group by provider rate possible values [0,1]. (Default: 0).

* NOTE by default grouped by originator, terminator and destination group

  • s_originator_id – id of user.
  • s_terminator_id – id of terminator.
  • s_device – id of device.
  • s_provider – id of provider.
  • a_src – value for CallerID.
  • a_dst – value for Destination.
  • s_duration - value for Duration.
  • dst_group – value for Destination Group.
  • use_real_billsec – Possible values [0,1]. (Default: 0).
  • from_user_perspective - Possible values [0,1]. (Default: 0).
  • answered_calls - show aggregates when Answered Calls >= value.
  • profit_show - Possible values [0,1]. (Default: 0).
  • clid - CallerID number or name



Request

If API Secret Key = secret

You send:

HTML POST: http://<SERVER IP>/billing/api/aggregate_get?u=admin&hash=e5e9fa1ba31ecd1ae84f75caaa474f3a663f05f4

* Note that username (u) is not included in the hash

Returns

Success

<page>
   <aggregates>
       <aggregate>
           <billed_originator>0.00113</billed_originator>
           <billed_originator_with_tax>0.00113</billed_originator_with_tax>
           <billed_terminator>0.00113</billed_terminator>
           <billed_duration_originator>1</billed_duration_originator>
           <billed_duration_terminator>1</billed_duration_terminator>
           <duration>1</duration>
           <answered_calls>1</answered_calls>
           <total_calls>1</total_calls>
           <asr>100.0</asr>
           <acd>1</acd>
           <dst_group>Iran - Mobile</dst_group>
           <originator>Test User 127</originator>
           <originator_id>127</originator_id>
           <terminator>Test User 105</terminator>
           <terminator_id>105</terminator_id>
       </aggregate>
       <aggregate>
           <billed_originator>0.026934</billed_originator>
           <billed_originator_with_tax>0.026934</billed_originator_with_tax>
           <billed_terminator>0.069991</billed_terminator>
           <billed_duration_originator>101</billed_duration_originator>
           <billed_duration_terminator>300</billed_duration_terminator>
           <duration>101</duration>
           <answered_calls>5</answered_calls>
           <total_calls>6</total_calls>
           <asr>83.3333333333333333</asr>
           <acd>21</acd>
           <dst_group>Russia - Mobile TWO</dst_group>
           <originator>Test User 127</originator>
           <originator_id>127</originator_id>
           <terminator>Test User 108</terminator>
           <terminator_id>108</terminator_id>
       </aggregate>
   </aggregates>
   <totals>
       <billed_originator>34.3554</billed_originator>
       <billed_originator_with_tax>34.3554</billed_originator_with_tax>
       <billed_terminator>23.7526</billed_terminator>
       <billed_duration_originator>22604</billed_duration_originator>
       <billed_duration_terminator>25085</billed_duration_terminator>
       <duration>22604</duration>
       <answered_calls>134</answered_calls>
       <total_calls>226</total_calls>
       <asr>59.29</asr>
       <acd>168</acd>
   </totals>
</page>

Errors

 <status>
  <error>You are not authorized to use this functionality</error>
 </status>
<page>
 <status>
   <error>Access Denied</error>
 </status>
</page>
<page>
 <status>
   <error>Device was not found</error>
 </status>
</page>
<page>
 <status>
   <error> Terminator was not found</error>
 </status>
</page>
<page>
 <status>
   <error> Provider was not found</error>
 </status>
</page>
<page>
 <status>
   <error> User was not found</error>
 </status>
</page>



See also