MOR API location rule update

From Kolmisoft Wiki
Jump to navigationJump to search

Description

Update localization rule

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

Reseller - can update localization rules for his own locations.



Usage

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



Parameters

Parameters which are included into hash:

  • location_rule_id - id of location rule which will be updated. 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.
  • enabled - enable or disable rule (enable - 1, disable - 0, default 1)
  • name - name of localization rule.
  • 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 (-1 if you want to unassign it).
  • lcr_id - id of lcr to change to (-1 if you want to unassign it).
  • did_id - id of did to route call to (-1 if you want to unassign it).
  • device_id - id of device to change call owner to (-1 if you want to unassign it).
  • change_callerid_name - change callerid name option (0 - disabled, 1 - enabled, default 0).
  • location_group_id - id of location group (available only for combined rules).
  • dst_locationgroup_id - id of location group (available only for combined rules).

Request

Example:

HTML POST: http://<SERVER_IP>/billing/api/location_rule_update?u=admin&location_rule_id=19&cut=8683&add=370683&minlen=1&maxlen=97&hash=9ddb5c8853d0a6a6299f70379ced8bdd78ce87af



Returns

<?xml version="1.0" encoding="UTF-8"?>
<page>
  <status>
    <success>Rule updated</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 rule was not found - location rule with location_rule_id does not exist or belongs to different account.
  • 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.
  • DID was not found - DID with did_id does not exist.
  • Tariff was not found - tariff does not exist or is not accessible.
  • Location Group was not found - location group with id location_group_id does not exist.
  • 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>
      <message>LCR was not found</message>
    </error>
  </status>
</page>

See also