Difference between revisions of "MOR API Service create"

From Kolmisoft Wiki
Jump to navigationJump to search
(Replaced content with '=Description= MOR API Create Service WIP <br><br>')
 
(4 intermediate revisions by 3 users not shown)
Line 1: Line 1:
=Description=
=Description=
[[MOR API]] Create Service   WIP
[[MOR API]] Create Service
<br><br>
<br><br>
=Usage=
* Call: /api/service_create
* Methods: POST, GET(if allowed, not recomended)
<br><br>
===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'''
<br><br>
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. 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'''.
* 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
<br><br>
===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'''
<br><br>
===Returns===
'''Success'''
<page>
  <status>
    <success>Service successfully created</success>
    <service>
      <id>3</id>
    </service>
  </status>
</page>
<br><br>
----
'''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>
<br><br>
=See also=
* [[MOR API]]
* [[MOR_API_Service_delete | Services delete]]
* [[MOR_API_Service_update | Service update]]

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