In this challenge you’re required to write a currency conversion web service with a two endpoints: GET [schema]:[host]:[port]/conversions?from=[fromCurrency]&to=[toCurrency]&date=[YYYY-M-D] This endpoint returns a JSON containing request parameters and conversion value, for example: {"from": "USD", "to": "ILS", "date": "2024-12-2", "value": 3.61} POST [schema]:[host]:[port]/conversions Body: {"url": [url to load historical values CSV from]} This endpoint loads a csv file (Example URL could be found here) with 4 columns (No column names): date, from currency, to currency and value.
•
Each new request should add to current values and not “reset” all values
•
More recent uploads can overwrite existing entries
•
File format is CSV without column headers,
תשובות
הוסף תשובה
|
לצפיה בתשובות
יולי 2024
Example line: 2022-03-25,USD,ILS,3.25 Example file URLs: first example second example Example test curl requests: curl -X POST http://127.0.0.1:8081/conversions -H 'Content-Type: application/json' -d '{"url": "https://balance-currency-converter-exercise.s3.amazonaws.com/conversions-2022-01.csv"}' curl http://127.0.0.1:8081/conversions?from=USD&to=ILS&