MOR API rate get

From Kolmisoft Wiki
Jump to navigationJump to search

Description

MOR API rate_get feature enables you to check rate over http.

Admin able to check Rates of his Users. Accountant with Permissions able to check Rates of Admins Users. Reseller able to check Rates of his Users.

Configuration

Go to SETTINGS –> Setup –> Settings

Settings path.png

In API tab ensure that MOR API is enabled and check Allow devices to check rate over HTTP option :

Settings api.png

Usage

  • From MOR X4 call: /api/rate_get
  • For Backwards-compatibility old name 'rate' is also usable. Call: /api/rate
  • Methods: POST, GET(if allowed, not recomended)



Parametres

  • u - username for authentication. From X5 - Required.
  • username – username of user whose rates you want to see.
  • prefix – prefix number of destination you want to see.
  • hash - SHA1 hash constructed using params and API_Secret_Key ( More described in Constructing hash). Required (if setting Disable hash checking is not checked).

NOTE: Don't use full number in API request. Use correct prefix only, because this method don't do prefix search, its only shows actual price for the exact prefix.

Request

HTML POST: http://<SERVER_IP>/billing/api/rate_get?u=admin&username=USERNAME&prefix=PREFIX&hash=HASH

Example:

http://127.0.0.1/billing/api/rate?u=admin&username=admin&prefix=370&hash=47fc73b6d374bd0a85e3984c1e1623451681569c



Returns

Success

Result is returned in format: rate#destination#prefix

<?xml version="1.0" encoding="UTF-8"?>
<page>
 <rate>0.987#Lithuania#370</rate>
</page>

NOTE. MOR API rate method shows rate, which is applied to User. If rate by prefix is not found in Custom Rates, it will be taken from Tariff assigned to User.


Errors

  • User do not have rates for selected destination:
<?xml version="1.0" encoding="UTF-8"?>
<page>
  <error>Rate was not found</error>
</page>
  • User with selected username does not exist:
<?xml version="1.0" encoding="UTF-8"?>
<page>
  <error>User was not found</error>
</page>
  • Allow devices to check rate over HTTP option in API Settings is not set:
<?xml version="1.0" encoding="UTF-8"?>
<page>
  <error>Feature disabled</error>
</page>
  • API is not allowed:
<?xml version="1.0" encoding="UTF-8"?>
<status>
  <error>API Requests are disabled</error>
</status>
  • User does not belong to the user who is trying to check rate or it was not found in the system:
<?xml version="1.0" encoding="UTF-8"?>
<status>
  <error>User was not found</error>
</status>
  • Accountant must have See Financial Data read or write permission and Manage Tariffs read or write permission enabled:
<?xml version="1.0" encoding="UTF-8"?>
<status>
  <error>You are not authorized to view this page</error>
</status>



See Also