Difference between revisions of "MOR API Service create"

From Kolmisoft Wiki
Jump to navigationJump to search
(Undo revision 18419 by Aisteb (Talk))
 
(3 intermediate revisions by 2 users not shown)
Line 13: Line 13:


* new_service_name - name of the Service '''Required'''.
* new_service_name - name of the Service '''Required'''.
* new_service_type - periodic_fee, one_time_fee or flat_rate. '''Required'''.
* new_service_type - periodic_fee, one_time_fee, dynamic_flat_rate or flat_rate. '''Required'''.
* service_sell_price -  price of the Service. '''Required'''.
* service_self_cost - self cost of the Service. '''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'''
'''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 23: Line 21:
* '''[[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. Last parameter in a row is '''API_Secret_Key''' ([[MOR API hash construction | More described in Constructing hash]]). '''Required'''.<br>
* '''[[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. 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'''.
* 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_period - month or day. For Periodic fee service type only.  
* service_minutes_per_month - for Flat-Rate 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
<br><br>
<br><br>
===Request===
===Request===


Line 41: Line 43:


'''Success'''
'''Success'''
<?xml version="1.0" encoding="UTF-8"?>
  <page>
  <page>
  <status>
  <status>
    <success>Service successfully created</success>
    <success>Service successfully created</success>
  </status>
    <service>
      <id>3</id>
    </service>
  </status>
  </page>
  </page>
<br><br>
<br><br>

Latest revision as of 11:25, 20 September 2019

Description

MOR API Create Service

Usage

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



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



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

Returns

Success

<page>
  <status>
    <success>Service successfully created</success>
    <service>
      <id>3</id>
    </service>
  </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>



See also