MOR API Service update

From Kolmisoft Wiki
Revision as of 07:43, 24 September 2014 by Aisteb (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search

NOTE: Available from MOR X5

Description

MOR API Update Service

Usage

  • From MOR X5 Call: /api/service_update
  • Methods: POST, GET(if allowed, not recomended)



Parametres

Parameters which are included into hash:

  • service_id - Service ID, which we want to delete. 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:

  • u - username for authentication. Required.
  • hash - SHA1 hash constructed using params and API_Secret_Key ( More described in Constructing hash). Required.
  • service_name - name of Service.
  • service_type - type of Service (periodic_fee, one_time_fee, flat-rate).
  • service_sell_price - sell price of Service.
  • service_self_cost - cost of Service.
  • service_period - period of Service (month, day, by default month only for Periodic Fee type).
  • service_minutes_per_month - how many minutes User is allowed to use Service (only for Flat Rate type).

Request

We have Service ID = 19, API Secret Key = secret
We send:

HTML POST: http://<SERVER_IP>/billing/api/service_update?u=admin&service_id=19&service_name=ddddddd&hash=38282ca5e65e63746498ef5b39a2fe71c6448df4

NOTE that username is not included in hash

Success

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




Errors

  • <error>Service Type is invalid</error> - Service type is unknown. It should be periodic_fee or one_time_fee or flat-rate.
  • <error>Quantity must be numeric</error> - Quantity was not numeric.
  • <error>Quantity must be greater than zero</error> - Quantity is less than zero.
  • <error>You are not authorized to use this functionality</error> - User has no permissions to manage Services.
  • <error>Access Denied</error> - User can not Manage Services and can not get permissions to use it.
  • <error>Service was not selected</error> - service_id parameter was not passed.
  • <error>Service was not found</error> - Service with passed service_id parameter was not found.
  • <error>Incorrect hash</error> - Hash was not correct. Check API_Secret_Key and order or parameters while concatenating hash_string.



Example:

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



See also