Skip to content

en-arnob/bitcoinRate-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

bitcoinRate-api

The user will set the currency code(USD, EUR, GBR) as a parameter in the request body. The server returns

  • The current Bitcoin rate, in the requested currency
  • The lowest Bitcoin rate in the last 30 days, in the requested currency
  • The highest Bitcoin rate in the last 30 days, in the requested currency

Dockerized at Docker Hub 🐳

$ docker run -p 8080:8080 enarnob/bitcoin_info-express-api:latest

API Endpoint Documentation

Returns json data about bitcoin info.

  • ENDPOINT

    /getBitcoinInfo

  • Method:

    GET

  • URL Params USD

  • URL

    /getBitcoinInfo?currency=usd

  • Success Response:

    • Code: 200
      Content:
      {
      "date": "2022-03-27",
      "requestedCurrency": "USD",
      "currentBitCoinRate": 44350.51,
      "lowestBitCoinRate": 37721.3933,
      "highestBitCoinRate": 44438.34,
      "interval": "30 Days"
      }
      
  • URL Params currency=EUR

  • URL

    /getBitcoinInfo?currency=eur

  • Success Response:

    • Code: 200
      Content:
      {
      "date": "2022-03-27",
      "requestedCurrency": "EUR",
      "currentBitCoinRate": 40375.5512,
      "lowestBitCoinRate": 33824.962,
      "highestBitCoinRate": 40376.6609,
      "interval": "30 Days"
      }
      
      
  • Invalid URL Params XYZ

  • URL

    /getBitcoinInfo?currency=xyz

  • Success Response:

    • Code: 200
      Content:
      {
      "Message": "Provide a valid currency: USD/EUR/GBP"
      }
  • Error Response:

    Content: { "msg": "Error occured fetching data from coindesk api" }

  • Sample Call :

      $.ajax({
        url: `http://localhost:8080/getBitcoinInfo?currency=${yourCurrency}`,
        dataType: "json",
        type : "GET",
        success : function(r) {
          console.log(r);
        }
      });

About

The user will set the currency code(USD, EUR, GBR) as a parameter in the request body.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published