MOR API Service create

From Kolmisoft Wiki

Jump to: navigation, search

Contents

[edit] Description

MOR API Create Service

[edit] Usage

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



[edit] Parametres

Parameters which are included into hash:

  • new_service_name - name of the Service Required.
  • new_service_type - periodic_fee, one_time_fee, dynamic_flat_rate or flat_rate. 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.
  • service_sell_price - price of the Service.
  • service_self_cost - self cost of the Service.
  • service_period - month or day. For Periodic fee service type only.
  • service_minutes_per_month - for Flat-Rate service type only.
  • new_owner_id - Only for admin, id of owner of service, which is admin or reseller



[edit] Request

We have u = admin, API Secret Key = secret

We send:

HTML POST: http://<SERVER_IP>/billing/api/service_create?u=admin&new_service_type=flat_rate&service_minutes_per_month=5&new_service_name=name&hash=38282ca5e65e63746498ef5b39a2fe71c6448df4
  • Now we can find this Service in GUI Services list.

* Note that username and password are not included in hash

[edit] Returns

Success

<?xml version="1.0" encoding="UTF-8"?>
<page>
 <status>
   <success>Service successfully created</success>
 </status>
</page>




Errors

  • <error>Access Denied</error> - user was not authorized or is simple user. Only admin, reseller or accounant can use this API method.
  • <error>Incorrect hash</error> - hash was not correct. Check API_Secret_Key and order or params while concatenating hash_string.
  • <error>Service must have service type</error> - type must be one of periodic_fee, one_time_fee or flat_rate.
  • <error>Flat Rate Service must have quantity</error> - Flat-Rate Service must have Minutes/month provided.
  • <error>Quantity must be numeric</error> - Minutes/month must be a number.
  • <error>Quantity must be greater than zero</error>
  • <error>Service Price must be numeric</error>
  • <error>Incorrect hash</error> - Hash was not correct. Check API_Secret_Key and order or params while concatenating hash_string.
  • <error>You are not authorized to use this functionality</error> - User has no permissions to manage Services.

Example:

<?xml version="1.0" encoding="UTF-8"?>
<page>
 <status>
   <error>Quantity must be numeric</error>
 </status>
</page>



[edit] See also

Personal tools

Try MOR

Try M2