Difference between revisions of "MOR API location rule create"

From Kolmisoft Wiki
Jump to navigationJump to search
(Created page with '<!---This functionality is available from MOR X14---> =Description= Create localization rule<br><br> '''Admin''' - can create localization rules for locations under Admin accoun…')
 
Line 29: Line 29:
* cut - cut pattern for destination  
* cut - cut pattern for destination  
* add - add pattern for destination..
* add - add pattern for destination..
* minlen - minimal length for destination pattern.
* minlen - minimal length for destination pattern (default 1).
* maxlen - maximum length for destination pattern.
* maxlen - maximum length for destination pattern (default 99).
* src_cut - cut pattern for source.
* src_cut - cut pattern for source.
* src_add - add pattern for source.
* src_add - add pattern for source.
* src_minlen - minimal length for source pattern.
* src_minlen - minimal length for source pattern (default 1).
* src_maxlen - minimal length for destination pattern.
* src_maxlen - minimal length for destination pattern(default 99).
* tariff_id - id of tariff to change to.  
* tariff_id - id of tariff to change to.  
* lcr_id - id of lcr to change to.
* lcr_id - id of lcr to change to.
Line 47: Line 47:
Example:
Example:


  HTML POST: http://<SERVER_IP>/billing/api/location_rule_create?u=admin&location_id=4&name=name&cut=86&add=3706&min=1&max=25&hash=baf07459ddbee3e88d759ec8245a019c1fda1cb6
  HTML POST: http://<SERVER_IP>/billing/api/location_rule_create?u=admin&location_id=4&name=name&cut=86&add=3706&minlen=1&maxlen=25&hash=baf07459ddbee3e88d759ec8245a019c1fda1cb6


<br><br>
<br><br>

Revision as of 13:20, 4 April 2019

Description

Create localization rule

Admin - can create localization rules for locations under Admin account.

Reseller - can create localization rules for his own locations.



Usage

  • From MOR X14 call: /api/location_rule_create
  • Methods: POST, GET(if allowed, not recommended)



Parameters

Parameters which are included into hash:

  • location_id - id of location where rule will be created. 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 (if setting Disable hash checking is not checked).
  • u - username for authentication. Either admin or reseller username Required.
  • name - name of localization rule. Required.
  • cut - cut pattern for destination
  • add - add pattern for destination..
  • minlen - minimal length for destination pattern (default 1).
  • maxlen - maximum length for destination pattern (default 99).
  • src_cut - cut pattern for source.
  • src_add - add pattern for source.
  • src_minlen - minimal length for source pattern (default 1).
  • src_maxlen - minimal length for destination pattern(default 99).
  • tariff_id - id of tariff to change to.
  • lcr_id - id of lcr to change to.
  • did_id - id of did to route call to.
  • device_id - id of device to change call owner to.
  • change_callerid_name - enable change callerid name option (0 - disabled, 1 - enabled, default 0).
  • lr_type - location rule type. Available options are: src, dst, combined. Default is dst.


Request

Example:

HTML POST: http://<SERVER_IP>/billing/api/location_rule_create?u=admin&location_id=4&name=name&cut=86&add=3706&minlen=1&maxlen=25&hash=baf07459ddbee3e88d759ec8245a019c1fda1cb6



Returns

<?xml version="1.0" encoding="UTF-8"?>
<page>
  <status>
    <success>Rule added</success>
  </status>
</page>

Errors

Possible Error return values are:

  • Rule must be unique - exact same rule already exists.
  • Rule must have name - name parameter is empty.
  • Cannot assign device - device id is not suitable (for example, device id is internal Provider device).
  • Cut and Add cannot be empty - both cut and add parameters are empty.
  • Device not found - device id does not exist.
  • Location error - location does not belong for Admin/Reseller.
  • Location not found - location with location_id does not exist.
  • Lcr was not found - LCR with lcr_id does not exist.
  • Cannot assign lcr - lcr_id was used in Reseller account.
  • Cannot assign did - did_id was used in Reseller account.
  • Tariff was not found - tariff does not exist or is not accessible.
  • Access Denied - incorrect authentication username.
  • Incorrect hash – Hash was not correct. Check API_Secret_Key and order or params while concatenating hash_string.

Example: <?xml version="1.0" encoding="UTF-8"?> <page>

 <status>
   <error>Location was not found</error>
 </status>

</page>

See also