Difference between revisions of "MOR API card balance get"

From Kolmisoft Wiki
Jump to navigationJump to search
(Created page with '=Description= <!---This functionality is available from MOR 12---> MOR API functionality that allows you to see the Calling Card's balance. <br><br> =Usage= * From '''MOR X4…')
 
 
(4 intermediate revisions by 2 users not shown)
Line 9: Line 9:


===Parameters===
===Parameters===
Parameters which are '''included''' into hash:


* number - Calling Card's unique number. '''Required'''.
* number - Calling Card's unique number. '''Required'''.
'''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'''
<br><br>
Parameters which are '''not included''' into hash:
* [[MOR API hash construction | hash]] - SHA1 hash constructed using parameters above and API_Secret_Key ([[MOR API hash construction | More described in Constructing hash]]). '''Required'''.
* u - username for authentication. '''Required'''.
* u - username for authentication. '''Required'''.
* hash - the generated API hash for the given parameters, please use MOR X4 hash generator to get one.
<br><br>
<br><br>
===Request===
===Request===


Line 25: Line 33:
We want to get the balance of a Calling Card numbered 1111111000, and our secret key is 'secretkey', our query will look like this:
We want to get the balance of a Calling Card numbered 1111111000, and our secret key is 'secretkey', our query will look like this:


http://<SERVER_ADDRESS>/billing/api/card_balance_get?u=admin&number=1111111000&hash=0d43cbd508a63230032ef593089833543ea297ea  
HTML POST http://<server_ip>/billing/api/card_balance_get?u=admin&number=1111111000&hash=0d43cbd508a63230032ef593089833543ea297ea  


'''NOTE that username is not included in hash'''
'''NOTE that username is not included in hash'''
<br><br>
<br><br>
===Returns===
===Returns===



Latest revision as of 06:45, 30 May 2014

Description

MOR API functionality that allows you to see the Calling Card's balance.

Usage

  • From MOR X4 call: /api/card_balance_get



Parameters

Parameters which are included into hash:

  • number - Calling Card's unique number. Required.

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:



Request

We want to access some user's Calling Card's balance as an admin, meaning we know the secret API key, in order to do so we must

  • Generate the hash key
  • Send the query to the API

For example:

We want to get the balance of a Calling Card numbered 1111111000, and our secret key is 'secretkey', our query will look like this:

HTML POST http://<server_ip>/billing/api/card_balance_get?u=admin&number=1111111000&hash=0d43cbd508a63230032ef593089833543ea297ea 

NOTE that username is not included in hash

Returns

Success

 <?xml version="1.0" encoding="UTF-8"?>
 <page>
   <calling_card>
     <balance> ... </balance>
     <currency> ... </currency>
   </calling_card>
 </page>




Errors

  • <error>User was not found</error> - User supplied bad username for authentication.
  • <error>Incorrect hash</error> - Hash was not correct. Check API_Secret_Key and order or params while concatenating hash_string.
  • <error>You are not authorised to use this functionality/error> - the specified user doesn't have permissions to use Calling Cards.
  • <error>Calling Card was not found</error> - the Card does not exist, or the specified user doesn't have access to it.



See also