MOR API card balance get
From Kolmisoft Wiki
Jump to navigationJump to search
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:
- hash - SHA1 hash constructed using parameters above and API_Secret_Key ( More described in Constructing hash). Required.
- u - username for authentication. Required.
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.