Difference between revisions of "MOR API tariff wholesale update"

From Kolmisoft Wiki
Jump to navigationJump to search
(Created page with '''This functionality is available from MOR 12'' MOR API Update or create new wholesale tariff <br><br> ---- <br><br> * Call: /api/wholesale_api…')
 
 
(7 intermediate revisions by 3 users not shown)
Line 1: Line 1:
''This functionality is available from [[MOR 12 documentation | MOR 12]]''
=Description=
<!---This functionality is available from MOR 12--->
[[MOR API]] Update or create new wholesale tariff
<br><br>
=Usage=
 
* From '''MOR X4''' call: '''/api/tariff_wholesale_update'''
* For Backwards-compatibility old name 'wholesale_tariff' is also usable. Call: '''/api/wholesale_tariff'''
* Methods: POST
<br><br>
===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'''.
* [[MOR API hash construction | hash]] - SHA1 hash constructed using '''params''' and '''API_Secret_Key''' ([[MOR API hash construction | More described in Constructing hash]]). '''Required''' (if setting '''Disable hash checking''' is not checked).
<br><br>
 
===Request===
 
* If tariff's id is not supplied, 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 tariff's id is supplied, existing tariff will be updated with supplied name and currency code


[[MOR API]]
We have currency=EUR and API Secret Key = 123456
Update or create new wholesale tariff


We send:
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'''
<br><br>
<br><br>
----
===Returns===
<br><br>
 
'''Success'''


* Call: /api/wholesale_api
* If tariff's id is not supplied, new tariff will be created with supplied name and currency code
* Methods: POST
* Params:
** u - username to login. '''Required'''.
** p - password to login. '''Required'''.
** id - wholesale tariff id in MOR database. '''Optional'''.
** name - tariff's name
** currency - tariff's currency code


If tariff's id is is not supplied, new tariff will be created with supplied name and currency code
<?xml version="1.0" encoding="UTF-8"?>
**Success:
  <page>
  <response>
   <status>ok</status>
   <status>ok</status>
   <tariff_id> ID </tariff_id>
   <tariff_id> ID </tariff_id>
  </response>
  </page>
** Error:
 
* If tariff's id is supplied, existing tariff will be updated with supplied name and currency code
 
<?xml version="1.0" encoding="UTF-8"?>
<page>
    <status>ok</status>
</page>
<br><br>
----
 
'''Errors'''
 
* Error if could not update or create tariff:
  <response>
  <response>
   <error>
   <error>
Line 31: Line 68:
  </response>
  </response>


If tariff's id is is supplied, existing tariff will be updated with supplied name and currency code
* Error if tariff was not found
**Success:
 
  <response>
  <?xml version="1.0" encoding="UTF-8"?>
  <status>ok</status>
<page>
  </response>
    <error>Tariff not found</error>
** Error if could not update tariff:
  </page>
  <response>
 
  <error>
* In case incorrect hash would be supplied:
    <message>error message</message>
 
  </error>
  <?xml version="1.0" encoding="UTF-8"?>
  </response>
<status>
** Error if tariff was not found
    <error>Incorrect hash</error>
<error> Tariff not found</error>
</status>              
 
*In case incorrect login would be supplied:
 
  <?xml version="1.0" encoding="UTF-8"?>
<page>
    <error>Bad login</error>
</page>>
<br><br>


**In case incorrect hash would be supplied:
=See also=
<error>Incorrect hash</error>               


**In case incorrect login would be supplied:
* [[MOR API]]
<error>Bad login</error>

Latest revision as of 07:12, 23 August 2013

Description

MOR API Update or create new wholesale tariff

Usage

  • From MOR X4 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 tariff's id is not supplied, 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 tariff's id is supplied, 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 username are not included in hash

Returns

Success

  • If tariff's id is not supplied, 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 tariff's id is supplied, 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 tariff was not found
<?xml version="1.0" encoding="UTF-8"?>
<page>
   <error>Tariff not found</error>
</page>
  • In case 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