MOR API device rule create

From Kolmisoft Wiki
Jump to navigationJump to search

Description

MOR API Create Device rule.

Usage

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



Parameters

Parameters which are included into hash:

  • device_id - Device ID on which this 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 which are listed above. 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 ( More described in Constructing hash). Required.
  • u - username for authentication. Required.
  • name - name of Rule. Required.
  • cut - cut pattern. Required* (either cut or add can be missing, but not both)
  • add - add pattern Required* (either cut or add can be missing, but not both)
  • minlen - Min Len value. The default value 1 will be used if the parameter is not specified.
  • maxlen - Max Len value. The default value 100 will be used if the parameter is not specified.
  • pr_type - Defines if this is src or dst rule. Allowed values src or dst. Default dst is used if this parameter is not specified.
  • change_callerid_name - Enable/disable Change CallerID name option. Allowed values 0 or 1. Default 0 is used if this parameter is not specified.



Request

HTML POST: http://<SERVER_IP>/billing/api/device_rule_create?u=admin&device_id=2&name=myrule&cut=353&add=0&hash=297dab8c386794b2e947d52affb8f576c643569e



Returns

Success

<page>
  <status>
    <success>Rule added</success>
  </status>
</page>




Errors

  • <error>Incorrect hash</error> - Hash was not correct. Check API_Secret_Key and order or params while concatenating hash_string.
  • <error>Add failed</error> - rule was not created.
  • <error>Device was not found</error> - Device id incorrect or User does not have permission to manage it.
  • <error>name cannot be blank</error> - incorrect or missing name parameter.
  • <error>both add and cut cannot be blank</error> - Cut and add pattern is missing. Only one of the can be blank.




See also