MOR API Calling Cards get

From Kolmisoft Wiki
Revision as of 14:06, 5 November 2015 by Edvinas (talk | contribs) (Created page with '=Description= MOR API Returns the list of Calling Cards with respect to provided search parameters. <br><br> =Usage= * Call: /api/calling_cards_get * Methods: POST, GET(if …')
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search

Description

MOR API Returns the list of Calling Cards with respect to provided search parameters.

Usage

  • Call: /api/calling_cards_get
  • Methods: POST, GET(if allowed, not recomended)



Parameters

  • hash - SHA1 hash constructed using the parameters which are listed above. Note that the parameters are shown in the same order as they need to be when generating the hash. The last parameter in a row is API_Secret_Key ( More described in Constructing hash). Required.
  • u - username for authentication. Required.
  • number - Calling Card's number.
  • name - Calling Card's name
  • pin - Calling Card's PIN code.
  • batch_number - Calling Card's batch number.
  • min_balance - lower boundary of the Calling Card's balance range.
  • max_balance - upper boundary of the Calling Card's balance range.
  • callerid - Calling Card's CallerID for "pinless" dialing.
  • language - Calling Card's language.
  • sold - Determines whether a Calling Card is sold or not (yes|no 1|0).
  • distributor - Calling Cards' distributor's (User's) id.



Request

We have u = admin, API Secret Key = secret

We send:

HTML POST: http://<SERVER_IP>/billing/api/calling_cards_get?u=admin&number=1111111119&name=test_card&pin=2668&min_balance=10&max_balance=50&language=en&callerid=3&sold=0&distributor=2&hash=e5e9fa1ba31ecd1ae84f75caaa474f3a663f05f4
  • Now we get a search result containing the Calling Card's with the specified attributes data.

* Note that a Username and a Password are not included into hash

Returns

Success

<?xml version="1.0" encoding="UTF-8"?>
<page>
  <cards>
    <card>
      <card_id>26</card_id>
      <card_number>1111111119</card_number>
      <card_name>test_card</card_name>
      <card_pin>2668</card_pin>
      <card_batch_number>5</card_batch_number>
      <card_callerid>3</card_callerid>
      <card_balance>10.0840336134454</card_balance>
      <card_minimal_balance>20.0</card_minimal_balance>
      <card_first_use/>
      <card_daily_charge_paid_till>2015-11-05 02:00:00 +0200</card_daily_charge_paid_till>
      <card_sold>0</card_sold>
      <card_language>en</card_language>
      <card_distributor>Test User #1</card_distributor>
    </card>
  </cards>
</page>




Errors

  • <error>Access Denied</error> - User is not authorized or is a Simple User. Only Admin, Reseller or Accounant can use this API method.
  • <error>Incorrect hash</error> - hash is not correct. Check API_Secret_Key and order or parameters while concatenating a hash_string.
  • <error>You are not authorized to use this functionality</error> - User has no permissions to manage Calling Cards.
  • <error>Card Group was not found</error> - Card Group under a given id does not exist or a card_group_id parameter is missing from the API parameters' list.
  • <error>Cards from was not found</error> - required cards_from parameter is missing.
  • <error>Cards till was not found</error> - required cards_till parameter is missing.
  • <error>Cards from is in incorrect format</error> - cards_from parameter's value is not numeric or is not 10-digit-long.
  • <error>Cards till is in incorrect format</error> - cards_till parameter's value is not numeric or is not 10-digit-long.
  • <error>Cards from must not be greater than Cards till</error> - cards_from parameter's value must not be grater than cards_till parameter's value. No proper Cards' number range is possible.
  • <error>PIN is too short for this interval</error> - Card Group does not provide enough PIN codes for a given Cards' number range.

Example:

<?xml version="1.0" encoding="UTF-8"?>
<page>
  <status>
    <error>Cards from must not be greater than Cards till</error>
  </status>
</page>



See also