Difference between revisions of "M4 API quickstats get"
From Kolmisoft Wiki
Jump to navigationJump to search
Line 41: | Line 41: | ||
<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> |
Revision as of 08:25, 25 July 2017
Description
Retrieves today's Quick Stats and Active Calls count
Data can be retrieved for Admin and by Admin only.
Usage
- M2 call: /api/quickstats_get
- Methods: POST, GET(if allowed, not recomended)
Parameters
- hash - SHA1 hash constructed using API_Secret_Key ( More described in Constructing hash). Required (if setting Disable hash checking is not checked).
- u - username for authentication. Required.
Request
If API Secret Key = secret
You send:
HTML POST: http://<SERVER_IP>/billing/api/quickstats_get?u=admin&hash=e5e9fa1ba31ecd1ae84f75caaa474f3a663f05f4
* Note that username (u) is not included in the hash
Returns
Success: Everything is ok. You get the list of calls if there is 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 username cannot use this method
- <error>Bad login</error> – such 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 or params while concatenating hash_string
- <error>Cannot connect to Elasticsearch</error> – data is not reachable
Example:
<status> <error>API Requests are disabled</error> </status>