Documentation

Skip to end of metadata
Go to start of metadata

Currencies Resource

The default currencies are euros, US dollars and Japanese yen. You may delete currencies but one currency must always remain in the system; this does not have to be a default currency. Add currencies before creating a pricing model. Note on significant digits: you can specify the number of digits after the decimal point for each currency. If you change the pricing model from a currency with more digits to one with fewer digits, then prices will be rounded up to the nearest digit in the new currency.

Main URI of the Resource

This class operates mainly over the Resource URI: /config/currencies

Exposed Methods

Retrieve the list of Currencies

This method returns the list of currencies.

Synopsis: GET http://example.com/api/config/currencies
Roles Required: ROLE_PRICING_VIEW
Request Headers: Accept: application/vnd.abiquo.currencies+json; version=3.2; application/vnd.abiquo.currencies+xml; version=3.2;  Content-type: ;
Request Parameters:

Parameter

Required

Default Value

Description

startwith

false

0The first element to be retrieved of the filtered search.

limit

false

25

The number of entities to retrieve.

has

true

""

A way to filter the search. Ex. by currency name.

by

false

name

Sort preference. Depends on the resource, this value affects different to the request.

asc

false

true

If the value of the 'by' parameter must be sorted in ascending way (true) or descending way (false)

Request Message Body Entity:
Response Message Body Entity: Currencies Media Type
Request Example:

 Click here to show or hide the request example

 

Retrieve the list of Currencies example
curl -X GET http://example.com/api/config/currencies\
     -H 'Accept: application/vnd.abiquo.currencies+xml; version=2.4'    \
     -u user:password --verbose

GET http://example.com/api/config/currencies HTTP/1.1
Authorization: Basic YWRtaW46eGFiaXF1bw==
Accept: application/vnd.abiquo.currencies+xml;version=2.4

HTTP/1.1 200 OK
Date: Wed, 16 Jan 2013 14:10:28 GMT
Set-Cookie: JSESSIONID=F534ECA52542651FB0506644926BEE74; Path=/api
Set-Cookie: auth=YWRtaW46MTM1ODM0NzIyOTIxMDpjZjg5ZTI3MTI0NDVlOTZhZTllMGNjNzNiMmRjY2RjYzpBQklRVU8; Expires=Wed, 16-Jan-2013 14:40:29 GMT; Path=/api
Server: Apache-Coyote/1.1
Content-Type: application/vnd.abiquo.currencies+xml;version=2.4
Content-Length: 911
<?xml version="1.0" encoding="UTF-8"?>
<currencies>
  <currency>
    <link href="http://example.com/api/config/currencies/1"
      rel="edit" type="application/vnd.abiquo.currency+xml"/>
    <digits>2</digits>
    <id>1</id>
    <name>Dollar - $</name>
    <symbol>USD</symbol>
  </currency>
  <currency>
    <link href="http://example.com/api/config/currencies/2"
      rel="edit" type="application/vnd.abiquo.currency+xml"/>
    <digits>2</digits>
    <id>2</id>
    <name>Euro - [0xe2][0x82][0xac]</name>
    <symbol>EUR</symbol>
  </currency>
  <currency>
    <link href="http://example.com/api/config/currencies/3"
      rel="edit" type="application/vnd.abiquo.currency+xml"/>
    <digits>0</digits>
    <id>3</id>
    <name>Yen - [0xc2][0xa5]</name>
    <symbol>JPY</symbol>
  </currency>
  <currency>
    <link href="http://example.com/api/config/currencies/5"
      rel="edit" type="application/vnd.abiquo.currency+xml"/>
    <digits>2</digits>
    <id>5</id>
    <name>JC-test-currency</name>
    <symbol>test-$</symbol>
  </currency>
</currencies>



Create a new Currency

Method to create a currency.

Synopsis: POST http://example.com/api/config/currencies
Roles Required: ROLE_PRICING_MANAGE
Request Headers: Accept: application/vnd.abiquo.currencies+json; version=3.2; application/vnd.abiquo.currencies+xml; version=3.2;  Content-type:  application/vnd.abiquo.currencies+json; version=3.2; application/vnd.abiquo.currencies+xml; version=3.2;
Request Parameters:

Parameter

Required

Default Value

Description

 

 

 

 

Request Message Body Entity: Currency Media Type
Response Message Body Entity: Currency Media Type
Request Example:

 Click here to show or hide the request example

 

Create a new Currency example
curl -X POST http://example.com/api/config/currencies\
     -H 'Accept: application/vnd.abiquo.currency+xml; version=2.4'  \
     -H 'Content-Type: application/vnd.abiquo.currency+xml; version=2.4'    \
     -d @entity.xml \
     -u user:password --verbose

POST http://example.com/api/config/currencies HTTP/1.1
Authorization: Basic YWRtaW46eGFiaXF1bw==
Accept: application/vnd.abiquo.currency+xml;version=2.4
Content-Type: application/vnd.abiquo.currency+xml;version=2.4
Content-Length: 164

HTTP/1.1 201 Created
Date: Wed, 16 Jan 2013 14:10:27 GMT
Location: http://example.com/api/config/currencies/4
Set-Cookie: JSESSIONID=F52CA5F5A906F5C8BDF7AD934DFA2B99; Path=/api
Set-Cookie: auth=YWRtaW46MTM1ODM0NzIyNzc5NDpkMjYzNDM5Nzc3MDA4YzBlNjA0NGE1Zjc2NmYyNGViNDpBQklRVU8; Expires=Wed, 16-Jan-2013 14:40:27 GMT; Path=/api
Server: Apache-Coyote/1.1
Content-Type: application/vnd.abiquo.currency+xml;version=2.4
Content-Length: 270
<?xml version="1.0" encoding="UTF-8"?>
<currency>
  <link href="http://example.com/api/config/currencies/4" rel="edit" type="application/vnd.abiquo.currency+xml"/>
  <digits>2</digits>
  <id>4</id>
  <name>JC-test-currency</name>
  <symbol>test-$</symbol>
</currency>

Download a template

You can download the template of the entity here (click right mouse button and 'Save Link As..')

 

Main URI of the Resource

This class operates mainly over the Resource URI: /config/currencies/{currency}

Exposed Methods

Retrieve a single Currency

Retrieve information of a single currency.

Synopsis: GET http://example.com/api/config/currencies/{currency}
Roles Required: ROLE_PRICING_VIEW
Request Headers: Accept: application/vnd.abiquo.currency+json; version=3.2; application/vnd.abiquo.currency+xml; version=3.2;  Content-type: ;
Request Parameters:

Parameter

Required

Default Value

Description

 

 

 

 

Request Message Body Entity:
Response Message Body Entity: Currency Media Type
Request Example:

 Click here to show or hide the request example

Retrieve a single Currency example
curl --verbose 'http://example.com/api/config/currencies/2' \
        -X GET \
        -H "Accept:application/vnd.abiquo.currency+xml; version=2.42; \
        -u "user:password"

> GET /api/config/currencies/2 HTTP/1.1
> Accept: application/vnd.abiquo.currency+xml; version=2.4;

   <currency>
        <link href="http://localhost:80/api/config/currencies/2" type="application/vnd.abiquo.currency+xml" rel="edit"/>
        <digits>2</digits>
        <id>2</id>
        <name>Euro - €</name>
        <symbol>EUR</symbol>
    </currency>



Delete Currency

Delete a currency. You must have at least one currency, so if you try to delete a currency and it is the only one, you will get an error message.

Synopsis: DELETE http://example.com/api/config/currencies/{currency}
Roles Required: ROLE_PRICING_MANAGE
Request Headers: Accept: ; Content-type: ;
Request Parameters:

Parameter

Required

Default Value

Description

 

 

 

 

Request Message Body Entity:
Response Message Body Entity:
Request Example:

 Click here to show or hide the request example

 

Delete Currency example
curl -X DELETE http://example.com/api/config/currencies/4\
     -u user:password --verbose

DELETE http://example.com/api/config/currencies/4 HTTP/1.1
Authorization: Basic YWRtaW46eGFiaXF1bw==

HTTP/1.1 204 No Content
Date: Wed, 16 Jan 2013 14:10:27 GMT
Set-Cookie: JSESSIONID=1F64095D67460832D03BAFA6BB0716BA; Path=/api
Set-Cookie: auth=YWRtaW46MTM1ODM0NzIyODcyNDpiYzg2YzdmYjI3ZDE3Yjg5Zjg3ODI0MzhiOGUzODdkOTpBQklRVU8; Expires=Wed, 16-Jan-2013 14:40:28 GMT; Path=/api
Server: Apache-Coyote/1.1


Update Currency

Update a currency.

Synopsis: PUT http://example.com/api/config/currencies/{currency}
Roles Required: ROLE_PRICING_MANAGE
Request Headers: Accept: application/vnd.abiquo.currency+json; version=3.2; application/vnd.abiquo.currency+xml; version=3.2;  Content-type:  application/vnd.abiquo.currency+json; version=3.2; application/vnd.abiquo.currency+xml; version=3.2;
Request Parameters:

Parameter

Required

Default Value

Description

 

 

 

 

Request Message Body Entity: Currency Media Type
Response Message Body Entity: Currency Media Type
Request Example:

 Click here to show or hide the request example

 

Update Currency example
curl -X PUT http://example.com/api/config/currencies/1\
     -H 'Accept: application/vnd.abiquo.currency+xml; version=2.4'  \
     -H 'Content-Type: application/vnd.abiquo.currency+xml; version=2.4'    \
     -d @entity.xml \
     -u user:password --verbose

PUT http://example.com/api/config/currencies/1 HTTP/1.1
Authorization: Basic YWRtaW46eGFiaXF1bw==
Accept: application/vnd.abiquo.currency+xml;version=2.4
Content-Type: application/vnd.abiquo.currency+xml;version=2.4
Content-Length: 289

HTTP/1.1 200 OK
Date: Wed, 16 Jan 2013 14:10:28 GMT
Set-Cookie: JSESSIONID=1D1CBA00229B462E2F4ABD1ABC971668; Path=/api
Set-Cookie: auth=YWRtaW46MTM1ODM0NzIyOTQ3MTo5YjJkODk5MzY5YjAxZDM3ZWUyODNmNzcwYjMzODVhNDpBQklRVU8; Expires=Wed, 16-Jan-2013 14:40:29 GMT; Path=/api
Server: Apache-Coyote/1.1
Content-Type: application/vnd.abiquo.currency+xml;version=2.4
Content-Length: 261
<?xml version="1.0" encoding="UTF-8"?>
<currency>
  <link href="http://example.com/api/config/currencies/1" rel="edit" type="application/vnd.abiquo.currency+xml"/>
  <digits>2</digits>
  <id>1</id>
  <name>Dollar - $</name>
  <symbol>USD</symbol>
</currency>




Download a template

You can download the template of the entity here (click right mouse button and 'Save Link As..')