API that fetches exchange-rates a publicly available API (https://exchangerate.host/) and uses them for conversion calculations
-
Type in your terminal:
git clone https://github.com/xaviqo/exchangeapi.git
-
Launch the following command form the project root directory:
mvn spring-boot:run
-
[GET] Get exchange rate from Currency A to Currency B:
/v1/exchange-rate/currency_a/currency_b
-
[GET] Get all exchange rates from Currency A:
/v1/all-rates/currency_a
-
[GET] Get value conversion from Currency A to Currency B:
/v1/value-conversion/currency_a/currency_b/amount
-
[POST] Get value conversion from Currency A to a list of supplied currencies:
/v1/multiple-values-conversion
Example payload:
{
"from":"EUR",
"amountTo":10,
"targetCurrencies":["GBP","HRK","MXN"]
}
-
[GET] Application health check:
/v1/health-check
In the application.properties file there are some parameters that can be adjusted
-
exchange-rate.host.time-out-sec: Threshold for external API response
-
exchange-rate.host.base: Base URL of the external API
-
exchange-rate.host.end-point.rates: Endpoint path to get the latest exchange rates
-
exchange-rate.host.end-point.symbols: Endpoint path to obtain the available currency codes
-
api.cfg.base-currency: ISO code of the currency that we will use for the conversion of values and for integration calls
-
api.cfg.cache.ttl-ms: Time to live in milliseconds of the cached data