Page tree
Skip to end of metadata
Go to start of metadata

To add a currency, use the following request:

POST /settings/currencies.xml
POST /settings/currencies.json

XML Request example

*curl -i -X POST -u user:userpass -H 'Accept: application/xml' -H 'Content-type: application/xml' -d '<currency><name>Ukrainian Gruvna</name><unit>§</unit><format>%n%u</format><code>UAH</code><separator>.</separator><precision>2</precision><precision_for_unit>4</precision_for_unit><delimiter>,</delimiter></currency>' --url http://onapp.test/settings/currencies.xml* 

JSON Request example

curl -i -X POST -u user:userpass -H 'Accept: application/json' -H 'Content-type: application/json' -d '{"currency":{"name":"Polski Zloti","unit":"§","format":"%n%u","code":"POZ","separator":".","precision":"4","precision_for_unit":"4","delimiter":","}}' --url http://onapp.test/settings/currencies.json 

Where:

name*– the currency label

unit* – a currency symbol ($, €, £, etc. )

format* - how the currency is displayed in the control panel. The following parameters are used: %n ( for the digits), %u ( for the currency symbol)

code* - three-character currency code that is generally used to represent the currency

separator* - a character used to format decimal numbers, e.g.: 100.99

precision* - the number of digits after the delimiter to display the costs

precision_for_unit – the numberof digits after the delimiter to display the prices for resources

delimiter* - a grouping character used to separate thousands, e.g.: 100,000,000.

  • Be aware, that it is prohibited to set the delimiter and separator which are identical.
  • The precision cannot exceed 8 symbols.

 


JSON Output example

{"currency":{"name":"Polski Zloti","created_at":"2011-04-19T17:20:26+03:00","format":"%n%u","code":"POZ","updated_at":"2011-04-19T17:20:26+03:00","id":7,"unit":"§","separator":".","precision":4,"delimiter":","}}
  • No labels