The following code will teach you to call and request information from the endpoint
This is another way of getting a value from API request.
let headersRequest = {
'Content-Type': 'application/json'
}
let apiUrl = "https://api.freecurrencyapi.com/v1/latest?apikey=fca_live_9YbQtanAqpYwy8475QRWA7fJotFsvOF8Mqo6KccW¤cies="+transactionCurrency+"&base_currency=INR"
let response = https.request({
method:https.Method.GET,
url: apiUrl,
body:transactionCurrency,
headers: headersRequest
});
if(response.code == 200){
let exchangerateResponse = JSON.parse(response.body);
let exchangeRate = exchangerateResponse.data[transactionCurrency];
let calAmount = feeAmount * exchangeRate;
if the output like this
{
"data":
{
"USD":0.0119264751
}
}