This document provides detailed information on the RESTful API endpoints for managing currency data. The API allows users to retrieve various financial data related to currencies, including average rates, maximum and minimum rates, date ranges, and more.
The base URL for the API is /api/v1
.
GET /api/v1/currencies
Retrieve a list of all available currencies.
- Method: GET
- Status Code: 200 OK
- Content: JSON array containing currency data.
GET /api/v1/currencies/select_one
Retrieve financial data for a specific currency code.
- Method: GET
- Query Parameters:
currency_code
(optional): Currency code (default: "eur_pln").
- Status Code: 200 OK
- Content: JSON object containing financial data for the specified currency code.
GET /api/v1/currencies/select_many
Retrieve financial data for multiple currency codes.
- Method: GET
- Query Parameters:
selected_columns
(required): List of currency codes to retrieve data for.
- Status Code: 200 OK
- Content: JSON array containing financial data for the specified currency codes.
GET /api/v1/currencies/select_many/save_to_csv
Retrieve financial data for multiple currency codes and save it to a CSV file.
- Method: GET
- Query Parameters:
selected_columns
(required): List of currency codes to retrieve data for.
- Status Code: 200 OK
- Content: JSON object with a success message indicating that the CSV file has been saved.
GET /api/v1/currencies/{currency_code}/average
Retrieve the average rate for a specific currency.
- Method: GET
- Path Parameters:
currency_code
(optional): Currency code (default: "eur_pln").
- Status Code: 200 OK
- Content: JSON object containing the average rate for the specified currency.
GET /api/v1/currencies/{currency_code}/maximum
Retrieve the maximum rate for a specific currency.
- Method: GET
- Path Parameters:
currency_code
(optional): Currency code (default: "eur_pln").
- Status Code: 200 OK
- Content: JSON object containing the maximum rate for the specified currency.
GET /api/v1/currencies/{currency_code}/minimum
Retrieve the minimum rate for a specific currency.
- Method: GET
- Path Parameters:
currency_code
(optional): Currency code (default: "eur_pln").
- Status Code: 200 OK
- Content: JSON object containing the minimum rate for the specified currency.
GET /api/v1/currencies/{currency_code}/date-range
Retrieve financial data for a specific currency within a specified date range.
- Method: GET
- Path Parameters:
currency_code
(optional): Currency code (default: "eur_pln").
- Query Parameters:
start_date
(required): Start date of the date range.end_date
(required): End date of the date range.
- Status Code: 200 OK
- Content: JSON array containing financial data for the specified currency within the specified date range.
The API may return the following error responses:
- 404 Not Found: Data not found.
- 422 Unprocessable Entity: Invalid input or missing required parameters.
- The date format for
start_date
andend_date
should be in the format "YYYY-MM-DD". - Currency codes should be valid and adhere to the
CurrencyCodeEnum
enumeration.
GET /api/v1/currencies
GET /api/v1/currencies/select_one?currency_code=usd_eur
GET /api/v1/currencies/select_many?selected_columns=usd_eur&selected_columns=gbp_usd
GET /api/v1/currencies/select_many/save_to_csv?selected_columns=usd_eur&selected_columns=gbp_usd
GET /api/v1/currencies/usd_eur/average
GET /api/v1/currencies/usd_eur/maximum
GET /api/v1/currencies/usd_eur/minimum
GET /api/v1/currencies/usd_eur/date-range?start_date=2023-01-01&end_date=2023-12-31
This API documentation provides comprehensive information on the available endpoints, request parameters, and expected responses. Users can leverage these endpoints to retrieve various financial data related to currencies.