Difference between revisions of "MOR API provider rule create"
From Kolmisoft Wiki
Jump to navigationJump to search
(Created page with "=Description= MOR API Create Provider rule. <br><br> =Usage= * Call: /api/provider_rule_create * Methods: POST, GET(if allowed, not recomended) <br><br> ===Parameters=== Parameters which are '''included''' into hash: * '''provider_id''' - Provder 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)....") |
|||
Line 12: | Line 12: | ||
Parameters which are '''included''' into hash: | Parameters which are '''included''' into hash: | ||
* '''provider_id''' - | * '''provider_id''' - Provider ID on which this rule will be created. '''Required''', | ||
* '''name''' - name of Rule, | * '''name''' - name of Rule, | ||
* '''cut''' - cut pattern (cut or add can be blank, but not both), | * '''cut''' - cut pattern (cut or add can be blank, but not both), | ||
* '''add''' - add 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. | '''Note that parameters are shown in the same order as they have to be when generating the hash. The last parameter in a row is API_Secret_Key''' | ||
<br><br> | <br><br> | ||
Parameters which are '''not included''' into hash: | Parameters which are '''not included''' into hash: | ||
* '''[[MOR API hash construction | 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. | * '''[[MOR API hash construction | 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. The last parameter in a row is '''API_Secret_Key''' ([[MOR API hash construction | More described in Constructing hash]]). '''Required'''.<br> | ||
* '''u''' - username for authentication. '''Required'''. | * '''u''' - username for authentication. '''Required'''. | ||
* '''minlen''' - Min Len value. Default value 1 will be used if parameter not specified. | * '''minlen''' - Min Len value. Default value 1 will be used if the parameter is not specified. | ||
* '''maxlen''' - Max Len value. | * '''maxlen''' - Max Len value. A default value of 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. | * '''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. | ||
* '''tariff_id''' - Change Provider Tariff to this Tariff | * '''tariff_id''' - Change Provider Tariff to this Tariff | ||
* '''set_pai''' - Set PAI. Possible values are 0/1 | * '''set_pai''' - Set PAI. Possible values are 0/1 | ||
* '''suffix''' - Adds Suffix. Available if pr_type = dst | * '''suffix''' - Adds Suffix. Available if pr_type = dst | ||
* '''change_callerid_name''' - Enable/disable Change CallerID name option. Allowed values 0 or 1. Default 0 is used if this parameter is not specified. | * '''change_callerid_name''' - Enable/disable the Change CallerID name option. Allowed values 0 or 1. Default 0 is used if this parameter is not specified. | ||
<br><br> | <br><br> | ||
Latest revision as of 07:05, 17 January 2023
Description
MOR API Create Provider rule.
Usage
- Call: /api/provider_rule_create
- Methods: POST, GET(if allowed, not recomended)
Parameters
Parameters which are included into hash:
- provider_id - Provider 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. The 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. The 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 the parameter is not specified.
- maxlen - Max Len value. A default value of 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.
- tariff_id - Change Provider Tariff to this Tariff
- set_pai - Set PAI. Possible values are 0/1
- suffix - Adds Suffix. Available if pr_type = dst
- change_callerid_name - Enable/disable the 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/provider_rule_create?u=admin&provider_id=5&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>Provider was not found</error> - Provider 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.