Exchange Rates

GET currencyConversion [Junior]


/exchange-rates/:rateType/from-:fromCurrency/to-:toCurrency/convert-amount/:amount

Description

Calculator used for getting the equated monthly installment (EMI) based on the amount borrowed, the interest, and the loan tenure (number of payments).

Request

Path Parameters

Following are the parameters that should be in the path of the request:

 

Headers

No headers or authentication required for making the request for this mock API. In the real API, there is a database access token. If you feel like it, try implementing it into the example server with the endpoint that is linked above!

Example Request

An example JavaScript fetch request that requests a conversion of 1000 GBP (Great British Pounds) to USD (US Dollars):


const requestOptions = {
  method: "GET",
  redirect: "follow"
};

fetch("http://localhost:3000/exchange-rates/cash/from-GBP/to-USD/convert-amount/1000", requestOptions)
  .then((response) => response.text())
  .then((result) => console.log(result))
  .catch((error) => console.error(error));

Response

Example

An example body of the response for the example request


{
	"amount": {
		"amount": 1369.86301369863,
		"currency": "USD"
	},
	"appliedRate": {
		"rate": 1.36986301369863,
		"isIndirect": true
	}
}

Headers

No headers for this example request.

Example solutions of this API

No solutions yet. Be the first one to submit one!

Additional resources

  • An article explaining how exchange rates work and why they fluctualte.