Difference between revisions of "MOR API card balance get"

From Kolmisoft Wiki
Jump to navigationJump to search
Line 25: Line 25:
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  
   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===



Revision as of 13:30, 12 August 2013

Description

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

Usage

  • From MOR X4 call: /api/card_balance_get



Parameters

  • number - Calling Card's unique number. Required.
  • u - username for authentication. Required.
  • hash - the generated API hash for the given parameters, please use MOR X4 hash generator to get one.



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:

 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