MOR API provider rule create

From Kolmisoft Wiki
Jump to navigationJump to search

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.




See also