8000 What happened to old currency-api · Issue #89 · fawazahmed0/exchange-api · GitHub
[go: up one dir, main page]

Skip to content

What happened to old currency-api #89

Open

Description

@fawazahmed0

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.

Activity

  1. pinned this issue on Mar 2, 2024
  2. iplanwebsites commented on Mar 3, 2024

    @iplanwebsites

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

  3. careybaird commented on Mar 10, 2024

    @careybaird
    8000

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

    Great idea to add the cloudflare fallback URL.

  4. vilmosnagy commented on Mar 15, 2024

    @vilmosnagy

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

  5. SpazzRabbit commented on Apr 9, 2024

    @SpazzRabbit

    @fawazahmed0 You also can use ipfs

  6. UsmanAkhtar0 commented on Aug 6, 2024

    @UsmanAkhtar0

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

  7. Not-Secret-Dev commented on Aug 31, 2024

    @Not-Secret-Dev

    Now how can I convert the currency?

  8. fawazahmed0 commented on Sep 1, 2024

    @fawazahmed0
    OwnerAuthor

    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]
  9. Krishna-D-developer commented on Sep 25, 2024

    @Krishna-D-developer

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

    how exactly can i use the new api

  10. dnet890 commented on Oct 18, 2024

    @dnet890

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

  11. kaustubh-tripathi-1 commented on Oct 29, 2024

    @kaustubh-tripathi-1

    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);
             if (!response.ok) {
                throw new Error(`Status : ${response.status}\n Status Text : ${response.statusText}`);
            }
            let responseJSON = await response.json();
    
           let rate = responseJSON[fromCurrency][toCurrency];
    
           
        } catch (error) {
            msg.innerHTML = `Failed to fetch exchange rate. Please try again later.`;
            console.error("Fetch error:", error);
            return;
        }
        
  12. Sreeman45 commented on Dec 11, 2024

    @Sreeman45

    hey guys,this is the simple way of accessing
    async function main(fromcurrency,tocurrency){ let data=await fetch(https://cdn.jsdelivr.net/npm/@fawazahmed0/currency-api@latest/v1/currencies/${fromcurrency}.json`)
    let jsondata=await data.json()
    let rate=jsondata[fromcurrency][tocurrency]
    }
    main('usd','inr')`

  13. AliAdnansid commented on Jan 12, 2025

    @AliAdnansid

    hey guys,this is the simple way of accessing async function main(fromcurrency,tocurrency){ let data=await fetch([https://cdn.jsdelivr.net/npm/@fawazahmed0/currency-api@latest/v1/currencies/${fromcurrency}.json](https://cdn.jsdelivr.net/npm/@fawazahmed0/currency-api@latest/v1/currencies/$%7Bfromcurrency%7D.json%60)) let jsondata=await data.json() let rate=jsondata[fromcurrency][tocurrency] } main('usd','inr')

    my code is not working can you please see whats the issue in it?

  14. junaid-khalil commented on Jan 31, 2025

    @junaid-khalil

    async function main(fromCurrency, toCurrency) {
    let response = await fetch(https://cdn.jsdelivr.net/npm/@fawazahmed0/currency-api@latest/v1/currencies/${fromCurrency}.json);
    let jsonData = await response.json();
    let rate = jsonData[fromCurrency][toCurrency];
    console.log(Exchange rate from ${fromCurrency} to ${toCurrency}: ${rate});
    }
    main('usd', 'inr');

    check this it works

  15. Shafiakram209 commented on Mar 20, 2025

    @Shafiakram209

    async function main(fromCurrency, toCurrency) {
    let response = await fetch(https://cdn.jsdelivr.net/npm/@fawazahmed0/currency-api@latest/v1/currencies/${fromCurrency}.json);
    let jsonData = await response.json();
    let rate = jsonData[fromCurrency][toCurrency]; // This is old and Not work

    let rate = jsonData[fromCurrency.value.toLowerCase()][toCurrency.value.toLowerCase()];// New Change here and It 100% work

    console.log(Exchange rate from ${fromCurrency)} to ${toCurrency}: ${rate});
    }
    main('usd', 'inr');

    check this it works

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      0