Difference between revisions of "MOR API Service update"
From Kolmisoft Wiki
Jump to navigationJump to search
(3 intermediate revisions by 2 users not shown) | |||
Line 13: | Line 13: | ||
Parameters which are '''included''' into hash: | Parameters which are '''included''' into hash: | ||
* service_id - Service ID, which we want to delete. '''Required'''. | * 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''' | |||
<br><br> | |||
Parameters which are '''not included''' into hash: | |||
* u - username for authentication. '''Required'''. | * u - username for authentication. '''Required'''. | ||
* [[MOR API hash construction | hash]] - SHA1 hash constructed using '''params''' and '''API_Secret_Key''' ([[MOR API hash construction | More described in Constructing hash]]). '''Required'''. | * [[MOR API hash construction | hash]] - SHA1 hash constructed using '''params''' and '''API_Secret_Key''' ([[MOR API hash construction | More described in Constructing hash]]). '''Required'''. | ||
* service_name - name of Service. | * service_name - name of Service. | ||
* service_type - type of Service (periodic_fee, one_time_fee, flat-rate). | * service_type - type of Service (periodic_fee, one_time_fee, flat-rate). | ||
Line 26: | Line 27: | ||
===Request=== | ===Request=== | ||
We have Service ID = 19, API Secret Key = secret | We have Service ID = 19, API Secret Key = secret<br> | ||
We send: | We send: | ||
HTML POST: http://<SERVER_IP>/billing/api/service_update?u=admin&service_id=19&service_name=ddddddd& | 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''' | '''NOTE that username is not included in hash''' | ||
<br><br> | <br><br> | ||
'''Success''' | '''Success''' | ||
<?xml version="1.0" encoding="UTF-8"?> | |||
<page> | <page> | ||
<status> | <status> | ||
Line 49: | Line 50: | ||
* <error>You are not authorized to use this functionality</error> - User has no permissions to manage Services. | * <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>Access Denied</error> - User can not Manage Services and can not get permissions to use it. | ||
* <error>Incorrect hash</error> - Hash was not correct. Check API_Secret_Key and order or | * <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. | |||
<br><br> | <br><br> | ||
Example: | |||
<?xml version="1.0" encoding="UTF-8"?> | |||
<page> | |||
<status> | |||
<error>Quantity must be numeric</error> | |||
</status> | |||
</page> | |||
<br><br> | |||
=See also= | =See also= | ||
* [[MOR API]] | * [[MOR API]] | ||
* [[MOR_API_Service_delete | Services delete]] | |||
* [[MOR_API_Service_create | Service create]] |
Latest revision as of 07:43, 24 September 2014
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>