Latest exchange rate from CurrencyApi.com - currencyapi
One script reply has been approved by the moderators Verified

Created by sindre svendby964 169 days ago Viewed 91 times 1 Point

Get the latest exchange rate from the currencyapi.com

No comments yet

Login to be able to comment
Points: 0
deno
One script reply has been approved by the moderators
Ap­pro­ved
type Currencyapi = {
  apiKey: string;
};
export async function main(
  currencyApiResource: Currencyapi,
  base_currency: string,
  currencies: string,
) {
  const paramString = new URLSearchParams({
    base_currency: base_currency,
    currencies: currencies,
  }).toString();

  const res = await fetch(
    `https://api.currencyapi.com/v3/latest?${paramString}`,
    {
      headers: {
        apikey: currencyApiResource.apiKey,
      },
    },
  );
  const data = await res.json();
  const currency = data?.data;
  return currency;
}

Submitted by sindre svendby964 169 days ago

Edited 46 days ago

No comments yet

Login to be able to comment