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>')
(Undo revision 18419 by Aisteb (Talk))
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 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'''
<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_period - month or day. For Periodic fee service type only.
* service_minutes_per_month - for Flat-Rate service type only.
<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'''
<?xml version="1.0" encoding="UTF-8"?>
<page>
  <status>
    <success>Service successfully created</success>
  </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]]

Revision as of 13:47, 30 September 2014

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 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

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_period - month or day. For Periodic fee service type only.
  • service_minutes_per_month - for Flat-Rate service type only.



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

<?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>



See also