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
- 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.