Difference between revisions of "MOR API autodialer get campaign statistics"

From Kolmisoft Wiki
Jump to navigationJump to search
Line 82: Line 82:
  </page>
  </page>


 
'''Errors''':
* Incorrect hash
* Incorrect hash
* Access Denied
* Access Denied

Revision as of 06:41, 3 June 2020

Description

Retrieves autodialer campaingn statistics for selected time period.

API can be used by:

Admin - can get any autodialer statistics.


Usage

  • From MOR X16: /api/autodialer_get_campaign_statistics



Parameters

Parameters which are included into hash:

  • u - User ID or Username in database
  • id - Caimpaign ID in database
  • period_start - Unix timestamp of stats period starting date. (Default: Today at 00:00).
  • period_end - Unix timestamp of stats period end date. (Default: Today at 23:59).

Note that parameters are shown in the same order as they have to be when generating the hash. Last parameter in a row is API_Secret_Key

Parameters which are not included into hash:

  • hash - SHA1 hash constructed using parameters above and API_Secret_Key ( More described in Constructing hash). Required (if setting Disable hash checking is not checked).
  • u - username for authentication. Required.
  • order_by - Possible values [time, src, dst, prefix, nice_billsec, hgc, server, p_name, p_rate, p_price, reseller, r_rate, r_price, user, u_rate, u_price, number, d_provider, d_inc, d_owner]. (Default: time).
  • s_reseller - Reseller type User ID in MOR database. (Default: all).



Request

If you want to get campaign statistics for admin, for campaign ID 2 from 06/01/2020 to 06/30/2020 and your API Secret Key = 456789

You send:

HTML POST:  http://<SERVER_IP>/billing/api/autodialer_get_campaign_statistics?u=admin&id=2&period_start=1590969600&period_end=1593475200&hash=7f544a3f199563efce4dc5da5425cdd0d7a41999



Returns

Success: Everything is ok. You get the list of calls if there is any:


<?xml version="1.0" encoding="UTF-8"?>
<page>
 <status>
   <campaign_name>Campaign Nr 2</campaign_name>
   <campaign_statistics>
     <period>
       <period_start>2020-06-01 03:00:00</period_start>
       <period_end>2020-06-30 03:00:00</period_end>
     </period>
     <total_numbers>2</total_numbers>
     <failed>1</failed>
     <completed>0</completed>
     <total_call_time></total_call_time>
     <total_call_time_longer_than_10s></total_call_time_longer_than_10s>
     <answered>
       <answered_calls>4</answered_calls>
       <answered_percent>40%</answered_percent>
     </answered>
     <no_answer>
       <no_answer_calls>3</no_answer_calls>
       <no_answer_percent>30%</no_answer_percent>
     </no_answer>
     <busy>
       <busy_calls>2</busy_calls>
       <busy_percent>20%</busy_percent>
     </busy>
     <failed>
       <failed_calls>1</failed_calls>
       <failed_percent>10%</failed_percent>
     </failed>
     <all_calls>
       <all_calls>10</all_calls>
       <all_calls_percent>100%</all_calls_percent>
     </all_calls>
   </campaign_statistics>
 </status>
</page>

Errors:

  • Incorrect hash
  • Access Denied
  • Campaign was not found
  • Campaign does not have any Numbers
  • Campaign does not have any Calls in selected time period
  • Date from is greater than date till

See also