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
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" }
- Code: 200
-
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" }
- Code: 200
-
Invalid URL Params
XYZ -
URL
/getBitcoinInfo?currency=xyz
-
Success Response:
- Code: 200
Content:{ "Message": "Provide a valid currency: USD/EUR/GBP" }
- Code: 200
-
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); } });