fawazahmed0 / exchange-api

Free Currency Exchange Rates API with 200+ Currencies & No Rate Limits
https://github.com/fawazahmed0/exchange-api#readme
Creative Commons Zero v1.0 Universal
639 stars 40 forks source link

What happened to old currency-api #89

Open fawazahmed0 opened 8 months ago

fawazahmed0 commented 8 months ago

I got email from GitHub to remove currency-api repository, due to large size. I have migrated things to cloudflare and npm. Please read the migration guide to migrate from old currency-api.

iplanwebsites commented 8 months ago

thanks for the clarification, let's home NPM will be fine with it.

careybaird commented 7 months ago

@fawazahmed0 I just wanted to say a big thank you for providing and maintaining this service 🙏

Great idea to add the cloudflare fallback URL.

vilmosnagy commented 7 months ago

@fawazahmed0 is there a way to download the data between 2022 and the migration? thanks

windows8prew commented 6 months ago

@fawazahmed0 You also can use ipfs

UsmanAkhtar0 commented 2 months ago

justice for /currencies/{currencyCode}/{currencyCode} Api user

Not-Secret-Dev commented 2 months ago

Now how can I convert the currency?

fawazahmed0 commented 2 months ago

justice for /currencies/{currencyCode}/{currencyCode} Api user

Old Currency API:

json = fetchJSON(`/currencies/{fromCurrency}/{toCurrency}`)
rate = json[toCurrency]

New Currency API:

json = fetchJSON(`/currencies/{fromCurrency}`)
rate = json[fromCurrency][toCurrency]
Krishna-D-developer commented 1 month ago

justice for /currencies/{currencyCode}/{currencyCode} Api user

how exactly can i use the new api

dnet890 commented 2 weeks ago

@Not-Secret-Dev with this new api we cannot convert currency anymore.

kaustubh-tripathi-1 commented 3 days ago

justice for /currencies/{currencyCode}/{currencyCode} Api user

how exactly can i use the new api

Guys I tried this and it is working.


const baseURL = `https://cdn.jsdelivr.net/npm/@fawazahmed0/currency-api@latest/v1/currencies`;

const URL = `${baseURL}/${fromCurrency}.json`;

// Use it in async func. obviously
try {
        let response = await fetch(URL);

        let responseJSON = await response.json();

       let rate = responseJSON[fromCurrency][toCurrency];

        if (!response.ok) {
            throw new Error(`Network response was not ok`);
        }
    } catch (error) {
        msg.innerHTML = `Failed to fetch exchange rate. Try again later.`;
        console.error("Fetch error:", error);
        return;
    }