Difference between revisions of "M4 API tariff wholesale update"

From Kolmisoft Wiki
Jump to navigationJump to search
 
(2 intermediate revisions by the same user not shown)
Line 1: Line 1:
=Description=
=Description=
<!---This functionality is available from MOR 12--->
 
[[MOR API]] Update or create new wholesale tariff
Update or create a new wholesale tariff
<br><br>
<br><br>
=Usage=
=Usage=


* '''M2''' call: '''/api/tariff_wholesale_update'''
* '''M4''' call: '''/api/tariff_wholesale_update'''
* For Backwards-compatibility old name 'wholesale_tariff' is also usable. Call: '''/api/wholesale_tariff'''
* For Backwards-compatibility old name 'wholesale_tariff' is also usable. Call: '''/api/wholesale_tariff'''
* Methods: POST
* Methods: POST
Line 20: Line 21:
===Request===
===Request===


* If tariff's id is not supplied, new tariff will be created with supplied name and currency code
* If the tariff's id is not supplied, a new tariff will be created with supplied name and currency code


We have tariff id=8, currency=EUR and API Secret Key = 123456
We have tariff id=8, currency=EUR and API Secret Key = 123456
Line 28: Line 29:
  HTML POST: http://<SERVER_IP>/billing/api/tariff_wholesale_update?u=username&id=8&currency=EUR&name=test&test=1&hash=af15a89d83b6110c6424f178e1707d4f61b6f9b7
  HTML POST: http://<SERVER_IP>/billing/api/tariff_wholesale_update?u=username&id=8&currency=EUR&name=test&test=1&hash=af15a89d83b6110c6424f178e1707d4f61b6f9b7


* If tariff's id is supplied, existing tariff will be updated with supplied name and currency code
* If the tariff's id is supplied, the existing tariff will be updated with supplied name and currency code


We have currency=EUR and API Secret Key = 123456
We have currency=EUR and API Secret Key = 123456
Line 36: Line 37:
  HTML POST: http://<SERVER_IP>/billing/api/tariff_wholesale_update?u=username&currency=EUR&name=test&test=1&hash=f7c3bc1d808e04732adf679965ccc34ca7ae3441
  HTML POST: http://<SERVER_IP>/billing/api/tariff_wholesale_update?u=username&currency=EUR&name=test&test=1&hash=f7c3bc1d808e04732adf679965ccc34ca7ae3441


'''NOTE that username are not included in hash'''
'''NOTE that usernames are not included in hash'''
<br><br>
<br><br>
===Returns===
===Returns===
Line 42: Line 43:
'''Success'''
'''Success'''


* If tariff's id is not supplied, new tariff will be created with supplied name and currency code
* If the tariff's id is not supplied, a new tariff will be created with supplied name and currency code


  <?xml version="1.0" encoding="UTF-8"?>
  <?xml version="1.0" encoding="UTF-8"?>
Line 50: Line 51:
  </page>
  </page>


* If tariff's id is supplied, existing tariff will be updated with supplied name and currency code
* If the tariff's id is supplied, the existing tariff will be updated with supplied name and currency code


  <?xml version="1.0" encoding="UTF-8"?>
  <?xml version="1.0" encoding="UTF-8"?>
Line 68: Line 69:
  </response>
  </response>


* Error if tariff was not found
* Error if the tariff was not found


  <?xml version="1.0" encoding="UTF-8"?>
  <?xml version="1.0" encoding="UTF-8"?>
Line 75: Line 76:
  </page>
  </page>


* In case incorrect hash would be supplied:
* In case an incorrect hash would be supplied:


  <?xml version="1.0" encoding="UTF-8"?>
  <?xml version="1.0" encoding="UTF-8"?>
Line 92: Line 93:
=See also=
=See also=


* [[M2 API]]
* [[M4 API]]

Latest revision as of 11:13, 28 November 2022

Description

Update or create a new wholesale tariff

Usage

  • M4 call: /api/tariff_wholesale_update
  • For Backwards-compatibility old name 'wholesale_tariff' is also usable. Call: /api/wholesale_tariff
  • Methods: POST



Parametres

  • u - username for authentication. Required.
  • id - wholesale tariff id in MOR database. Optional.
  • name - tariff's name. Optional.
  • currency - tariff's currency code. Optional.
  • hash - SHA1 hash constructed using params and API_Secret_Key ( More described in Constructing hash). Required (if setting Disable hash checking is not checked).



Request

  • If the tariff's id is not supplied, a new tariff will be created with supplied name and currency code

We have tariff id=8, currency=EUR and API Secret Key = 123456

We send:

HTML POST: http://<SERVER_IP>/billing/api/tariff_wholesale_update?u=username&id=8&currency=EUR&name=test&test=1&hash=af15a89d83b6110c6424f178e1707d4f61b6f9b7
  • If the tariff's id is supplied, the existing tariff will be updated with supplied name and currency code

We have currency=EUR and API Secret Key = 123456

We send:

HTML POST: http://<SERVER_IP>/billing/api/tariff_wholesale_update?u=username&currency=EUR&name=test&test=1&hash=f7c3bc1d808e04732adf679965ccc34ca7ae3441

NOTE that usernames are not included in hash

Returns

Success

  • If the tariff's id is not supplied, a new tariff will be created with supplied name and currency code
<?xml version="1.0" encoding="UTF-8"?>
<page>
 <status>ok</status>
 <tariff_id> ID </tariff_id>
</page>
  • If the tariff's id is supplied, the existing tariff will be updated with supplied name and currency code
<?xml version="1.0" encoding="UTF-8"?>
<page>
   <status>ok</status>
</page>




Errors

  • Error if could not update or create tariff:
<response>
 <error>
   <message>error message</message>
 </error>
</response>
  • Error if the tariff was not found
<?xml version="1.0" encoding="UTF-8"?>
<page>
   <error>Tariff not found</error>
</page>
  • In case an incorrect hash would be supplied:
<?xml version="1.0" encoding="UTF-8"?>
<status>
    <error>Incorrect hash</error>
</status>               
  • In case incorrect login would be supplied:
<?xml version="1.0" encoding="UTF-8"?>
<page>
   <error>Bad login</error>
</page>>



See also