MOR API location rule update

From Kolmisoft Wiki
Revision as of 13:38, 4 April 2019 by Gilbertas (talk | contribs)
Jump to navigationJump to search

Description

Create 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 modified. 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 - 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.
  • DID was not found - DID with did_id does not exist.
  • 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