Difference between revisions of "MOR API user calls get"
From Kolmisoft Wiki
Jump to navigationJump to search
Line 16: | Line 16: | ||
===Request=== | ===Request=== | ||
HTML POST: http://<SERVER_IP>/billing/api/user_calls_get?u=username&s_user= | HTML POST: http://<SERVER_IP>/billing/api/user_calls_get?u=username&s_user=5&period_start=1320191999&period_end=1322697599&s_device=7 | ||
<br> | <br> | ||
===Parameters=== | ===Parameters=== |
Revision as of 12:16, 20 May 2013
Description
Retrieves list of calls in selected time period for specified User/Device.
Admin - can get any user calls
Reseller - can get his and his users calls.
User - can get his own calls.
Usage
- Call: /api/user_calls_get
- Methods: POST, GET(if allowed, not recomended)
Request
HTML POST: http://<SERVER_IP>/billing/api/user_calls_get?u=username&s_user=5&period_start=1320191999&period_end=1322697599&s_device=7
Parameters
- u - username to login. Required.
- s_user - User's ID in MOR database. Required.
- period_start - Unix timestamp of calls period starting date. (Default: Today at 00:00).
- period_end - Unix timestamp of calls period end date. (Default: Today at 23:59).
- s_call_type - Call type. Possible values [all, answered, no answer, failed, busy]. (Default: all)
- s_device - Device ID in MOR database. Possible values [all, numeric value of device_id]. (Default: all)
- s_provider - Provider ID in MOR database. Possible values [all, numeric value of provider_id]. (Default: all).Only for Admin and Reseller PRO.
- s_hgc - Hangup cause code ID in MOR database. Possible values [all, numeric value of hangup_cause_code_id]. (Default: all). Only for Admin and Reseller if Show HGC for Resellers is ON
- s_destination - prefix.
- s_did - show calls made through specific DID. Possible values [all, calls.did_id]. (Default: all). Only for Admin.
- 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)
- order_desc - Possible values [0,1]. (Default: 0).
- only_did - show calls that only went through did. Possible values [0,1]. (Default: 0).
- hash - SHA1 hash constructed using params and API_Secret_Key ( More described in Constructing hash). Required (if setting Disable hash checking is not checked).
Returns
Success: Everything is ok. You get the list of calls if there is any:
<?xml version="1.0" encoding="UTF-8"?> <page> <pagename>Calls</pagename> <language>en</language> <error_msg></error_msg> <userid>0</userid> <username>admin</username> <total_calls>1</total_calls> <currency>USD</currency> <calls_stat> <period> <period_start>2008-03-07 11:48:18</period_start> <period_end>2012-03-07 11:46:01</period_end> </period> <show_user>all</show_user> <show_device>all</show_device> <show_status>all</show_status> <show_provider>4</show_provider> <show_hgc>all</show_hgc> <show_did>1</show_did> <calls> <call> <calldate2>2009-01-02 00:00:01</calldate2> <clid>37046246362</clid> <destination>Lithuania MOB Lithuania mobile</destination> <did>37063042438</did> <did_inc_price>1.0</did_inc_price> <did_price>1.0</did_price> <did_prov_price>1.0</did_prov_price> <dispod>ANSWERED(16)</dispod> <dst>37063042438</dst> <nice_billsec>20.0</nice_billsec> <nice_reseller> </nice_reseller> <prefix>3706</prefix> <profit>4</profit> <provider_name>Test Provider</provider_name> <provider_price>1.0</provider_price> <provider_rate>0.0</provider_rate> <reseller_price>0.0</reseller_price> <reseller_rate>0.0</reseller_rate> <server_id>1</server_id> <src>37046246362</src> <user></user> <user_price>2.0</user_price> <user_rate>0.0</user_rate> </call> </calls> </calls_stat> </page>
Error:
- Such username does not exist in the database or it was not specified:
<?xml version="1.0" encoding="UTF-8"?> <error>Access Denied</error>
- User was not found using user_id. Use correct user_id:
<?xml version="1.0" encoding="UTF-8"?> <error>User was not found</error>
- Hash was not correct. Check API_Secret_Key and order or params while concatenating hash_string:
<?xml version="1.0" encoding="UTF-8"?> <error>Incorrect hash</error>
- Example:
- We have s_user = 123, API Secret Key = 456789
- Hash string to be converted: "123456789"
- We send:
- /api/user_calls?u=admin&s_user=123&hash=f7c3bc1d808e04732adf679965ccc34ca7ae3441
* Note that username is not included in hash