MOR API device rule create

From Kolmisoft Wiki

Jump to: navigation, search

Contents

[edit] Description

MOR API Create Device rule.

[edit] Usage

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



[edit] Parameters

Parameters which are included into hash:

  • device_id - Device ID on which this rule will be created. Required,
  • name - name of Rule,
  • cut - cut pattern (cut or add can be blank, but not both),
  • add - add pattern (cut or add can be blank, but not both).

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.
  • minlen - Min Len value. Default value 1 will be used if parameter not specified.
  • maxlen - Max Len value. Default value 100 will be used if parameter 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.



[edit] Request

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



[edit] 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.




[edit] See also

Personal tools

Try MOR

Try M2