M4 API aggregate get

From Kolmisoft Wiki
Revision as of 11:11, 28 November 2022 by Admin (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search

Description

M4 API for getting M4 aggregate statistic.




Usage

  • M4 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_originator – group by originator possible values [0,1]. (Default: 0).
  • group_by_op – group by origination point possible values [0,1]. (Default: 0).
  • group_by_terminator – group by terminator possible values [0,1]. (Default: 0).
  • group_by_tp – 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).

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

  • s_originator_id – id of originator.
  • s_terminator_id – id of terminator.
  • s_op_device – id of origination point.
  • s_tp_device – id of termination point.
  • a_src – value for CallerID
  • a_dst – value for Destination
  • 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.



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>
     <pdd>0.0</pdd>
     <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>
     <pdd>0.0</pdd>
     <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>
   <pdd>0.0000</pdd>
 </totals>
</page>

Errors

 <status>
  <error>Incorrect hash</error>
 </status>
<page>
 <status>
   <error>No data found</error>
 </status>
</page>
<page>
 <status>
   <error>Access Denied</error>
 </status>
</page>



See also