Difference between revisions of "MOR API quickstats get"

From Kolmisoft Wiki
Jump to navigationJump to search
(Created page with '=Description= Retrieves today's Quick Stats and Active Calls count<br><br> Data can be retrieved by '''Admin''' only <br> =Usage= * Call: /api/quickstats_get '''(fro…')
 
 
(5 intermediate revisions by 3 users not shown)
Line 3: Line 3:
Retrieves today's [[Quick Stats]] and [[Active Calls]] count<br><br>
Retrieves today's [[Quick Stats]] and [[Active Calls]] count<br><br>


Data can be retrieved by '''Admin''' only
Data can be retrieved for '''Admin''', '''Reseller''', '''Simple User'''


<br>
<br>
Line 15: Line 15:


* [[MOR API hash construction | hash]] - SHA1 hash constructed using API_Secret_Key ([[MOR API hash construction | More described in Constructing hash]]). '''Required''' (if setting '''Disable hash checking''' is not checked).  
* [[MOR API hash construction | hash]] - SHA1 hash constructed using API_Secret_Key ([[MOR API hash construction | More described in Constructing hash]]). '''Required''' (if setting '''Disable hash checking''' is not checked).  
Parameters which are '''included''' into hash:
* u - username  for authentication. '''Required'''.  
* u - username  for authentication. '''Required'''.  
'''Note that u is included in to the HASH only if u is not an Admin'''
<br><br>
<br><br>
===Request===
===Request===


Line 25: Line 29:
  HTML POST: http://<SERVER_IP>/billing/api/quickstats_get?u=admin&hash=e5e9fa1ba31ecd1ae84f75caaa474f3a663f05f4
  HTML POST: http://<SERVER_IP>/billing/api/quickstats_get?u=admin&hash=e5e9fa1ba31ecd1ae84f75caaa474f3a663f05f4


'''* Note that username (u) is not included in the hash'''
<br><br>
<br><br>


Line 41: Line 44:
       <self_cost> Expenditure today</self_cost>
       <self_cost> Expenditure today</self_cost>
       <profit> Difference of revenue and expences</profit>
       <profit> Difference of revenue and expences</profit>
      <margin> profit's part in the sell price</margin>
     </today>
     </today>
     <active_calls>
     <active_calls>
Line 65: Line 69:
=See also=
=See also=


* [[M2 API]]
* [[MOR API]]

Latest revision as of 11:05, 1 August 2017

Description

Retrieves today's Quick Stats and Active Calls count

Data can be retrieved for Admin, Reseller, Simple User


Usage

  • Call: /api/quickstats_get (from MOR X7)
  • Methods: POST, GET (if allowed, not recomended)



Parameters

Parameters which are included into hash:

  • u - username for authentication. Required.

Note that u is included in to the HASH only if u is not an Admin

Request

If API Secret Key = secret

You send:

HTML POST: http://<SERVER_IP>/billing/api/quickstats_get?u=admin&hash=e5e9fa1ba31ecd1ae84f75caaa474f3a663f05f4



Returns

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

<?xml version="1.0" encoding="UTF-8"?>
<page>
 <quickstats>
   <today>
     <calls> Calls count </calls>
     <duration> Billsec in seconds </duration>
     <revenue> Revenue today</revenue>
     <self_cost> Expenditure today</self_cost>
     <profit> Difference of revenue and expences</profit>
     <margin> profit's part in the sell price</margin>
   </today>
   <active_calls>
     <total> Active Calls count </total>
     <answered_calls> Answered Calls count </answered_calls>
   </active_calls>
 </quickstats>
</page>

Errors:

  • <error>API Requests are disabled</error> – Allow API globally setting is unchecked
  • <error>GET Requests are disabled</error> – Allow GET API setting is unchecked
  • <error>Access Denied</error> – User with such a username cannot use this method or such a username does not exist in the database or it was not specified
  • <error>Incorrect hash</error> – Hash was not correct. Check API_Secret_Key and order of parameters while concatenating the hash_string
  • <error>Cannot connect to Elasticsearch</error> – data is not reachable

Example:

 <status>
   <error>API Requests are disabled</error>
 </status>



See also