Difference between revisions of "MOR API Calling Cards create"

From Kolmisoft Wiki
Jump to navigationJump to search
 
(3 intermediate revisions by 2 users not shown)
Line 4: Line 4:
=Usage=
=Usage=


* Call: /api/calling_cards_create
* Call: /api/calling_cards_create '''(from MOR X7)'''
* Methods: POST, GET(if allowed, not recomended)
* Methods: POST, GET(if allowed, not recomended)
<br><br>
<br><br>
Line 16: Line 16:
* cards_till - Cards' (to be created) number range ending '''Required'''.
* cards_till - Cards' (to be created) number range ending '''Required'''.


'''* Note that cards_from <= cards_till. Both of the previous parameters are 10-digit-long integers.'''<br>
'''* Note that cards_from <= cards_till. Both of the previous parameters are corresponding to Calling Card Group Number Length.'''<br>
'''* 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 an API_Secret_Key.'''
'''* 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 an API_Secret_Key.'''


Line 62: Line 62:
* <error>Access Denied</error> - User is not authorized or is a Simple User. Only Admin, Reseller or Accounant can use this API method.  
* <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>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>You are not authorized to use this functionality</error> - User has no permissions to manage Calling Cards.
* <error>Bad login</error> - User is not authorized (possibly wrong Username).  
* <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>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 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 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 from is in incorrect format</error> - cards_from parameter's value is not numeric or is not correspond to Calling Card Group Number Length.  
* <error>Cards till is in incorrect format</error> - cards_till 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 correspond to Calling Card Group Number Length.  
* <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>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.  
* <error>PIN is too short for this interval</error> - Card Group does not provide enough PIN codes for a given Cards' number range.  

Latest revision as of 14:01, 11 January 2017

Description

MOR API Calling Cards create

Usage

  • Call: /api/calling_cards_create (from MOR X7)
  • Methods: POST, GET(if allowed, not recomended)



Parameters

Parameters which are included into hash:

  • card_group_id - id of a Card Group Required.
  • cards_from - Cards' (to be created) number range beginning Required.
  • cards_till - Cards' (to be created) number range ending Required.

* Note that cards_from <= cards_till. Both of the previous parameters are corresponding to Calling Card Group Number Length.
* 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 an API_Secret_Key.



Parameters which are not included into hash:

  • 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.
  • batch_number - batch number for the Calling Cards.
  • min_balance - minimum balance for the Calling Cards.
  • distributor_id - Calling Cards' distributor's (User's) id.
  • language - Language for the Calling Cards.



Request

We have u = admin, API Secret Key = secret

We send:

HTML POST: http://<SERVER_IP>/billing/api/calling_cards_create?u=admin&card_group_id=1&cards_from=1000000025&cards_till=1000000035&batch_number=50&
min_balance=15&language=en&distributor_id=2&hash=7e112ededcfee097cce21b6201c6d2a00dda1f4c
  • Now we can find 11 newly created Calling Cards (number range: 1000000025-1000000035) in the Card Group's (id = 1) Cards' list.

* Note that some Calling Cards may fail on creation if a given range overlaps with already existing Cards in a Card Group.
* Note that passing invalid optional parameters will not be notified. Default values will be used instead.
* Note that a Username and a Password are not included into hash

Returns

Success

<?xml version="1.0" encoding="UTF-8"?>
<page>
  <status>
    <success>Cards created: 11/11</success>
  </status>
</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 correspond to Calling Card Group Number Length.
  • <error>Cards till is in incorrect format</error> - cards_till parameter's value is not numeric or is not correspond to Calling Card Group Number Length.
  • <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