Difference between revisions of "MOR API Exchange rate update"
From Kolmisoft Wiki
Jump to navigationJump to search
Line 37: | Line 37: | ||
* <error>Access Denied</error> - User is not authorized or is a Simple User. Only Admin can use this API method. | * <error>Access Denied</error> - User is not authorized or is a Simple User. Only Admin can use this API method. | ||
* <error>Incorrect hash</error> - hash is not correct. Check API_Secret_Key and order | * <error>Incorrect hash</error> - hash is not correct. Check API_Secret_Key and order of parameters while concatenating a hash_string. | ||
* <error>Exchange rate is invalid</error> - Exchange rate is not a valid number. | * <error>Exchange rate is invalid</error> - Exchange rate is not a valid number. | ||
* <error>Currency was not found</error> - Currency was not found by its name or an automatic update is enabled for it. | * <error>Currency was not found</error> - Currency was not found by its name or an automatic update is enabled for it. |
Latest revision as of 13:27, 2 May 2017
Description
MOR API Exchange rate update. API method used to update Currency exchange rates.
Usage
- Call: /api/exchange_rate_update (from MOR X10).
- Methods: POST, GET (if allowed, not recomended).
- Only System Admin can use this API method.
Parameters
Parameters which are included into hash:
- currency - name of a Currency (case sensitive) e.g. USD. Required.
- rate - exchange rate. Required.
Parameters which are not included into hash:
- hash - SHA1 hash constructed using the parameters which are listed above. Note that the parameters are shown in the same order as they need to be when generating the hash. The last parameter in a row is API_Secret_Key ( More described in Constructing hash). Required.
- u - username for authentication. Required.
NOTE Only Currencies which have the automatic update disabled can be used in this API.
Request
We have u = admin, API Secret Key = secret. We send:
HTML POST:http://<SERVER_IP>/billing/api/exchange_rate_update?u=admin¤cy=AMD&rate=45.5&hash=cd4e5e92a0fe326d6f5c1d40a7952bb4442e1b5d
Returns
Success
<?xml version="1.0" encoding="UTF-8"?> <page> <status> <success>Currency successfully updated</success> </status> </page>
Errors
- <error>Access Denied</error> - User is not authorized or is a Simple User. Only Admin can use this API method.
- <error>Incorrect hash</error> - hash is not correct. Check API_Secret_Key and order of parameters while concatenating a hash_string.
- <error>Exchange rate is invalid</error> - Exchange rate is not a valid number.
- <error>Currency was not found</error> - Currency was not found by its name or an automatic update is enabled for it.
Example:
<?xml version="1.0" encoding="UTF-8"?> <page> <status> <error>Exchange rate is invalid</error> </status> </page>