Difference between revisions of "MOR API device rule create"

From Kolmisoft Wiki
Jump to navigationJump to search
(Created page with '=Description= MOR API Create Device rule. <br><br> =Usage= * Call: /api/device_rule_create * Methods: POST, GET(if allowed, not recomended) <br><br> ===Parameters=== Para…')
 
 
Line 12: Line 12:
Parameters which are '''included''' into hash:
Parameters which are '''included''' into hash:


* '''device_id''' - Device ID on which this rule will be created. '''Required'''.
* '''device_id''' - Device ID on which this rule will be created. '''Required''',
* '''name''' - name of Rule.
* '''name''' - name of Rule,
* '''cut''' - cut pattern.
* '''cut''' - cut pattern (cut or add can be blank, but not both),
* '''add''' - add pattern.
* '''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'''
'''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'''
Line 50: Line 50:
* <error>Device was not found</error> - Device id incorrect or User does not have permission to manage it.
* <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>name cannot be blank</error> - incorrect or missing name parameter.
* <error>cut cannot be blank</error> - incorrect or missing cut parameter.
* <error>both add and cut cannot be blank</error> - Cut and add pattern is missing. Only one of the can be blank.
* <error>add cannot be blank</error> - incorrect or missing add parameter.
 
<br><br>
<br><br>



Latest revision as of 16:12, 21 January 2020

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,
  • 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.



Request

HTML POST: http://<SERVER_IP>/billing/api/device_rule_create?u=admin&device=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