Skip to main content

Get All Currencies

curl http://localhost:8080/api/Currency
Retrieves a list of all currencies in the system.

Response

currencies
array
Array of currency objects
id
integer
Unique identifier for the currency
code
string
Three-letter currency code (ISO 4217 format)
fullName
string
Full name of the currency
sign
string
Currency symbol

Example Response

[
  {
    "id": 1,
    "code": "USD",
    "fullName": "United States Dollar",
    "sign": "$"
  },
  {
    "id": 2,
    "code": "EUR",
    "fullName": "Euro",
    "sign": "€"
  },
  {
    "id": 3,
    "code": "GBP",
    "fullName": "British Pound Sterling",
    "sign": "£"
  }
]

Find Currencies

curl http://localhost:8080/api/Currency/USD
Searches for currencies matching the provided search string. The search matches against currency codes and names.

Path Parameters

searchString
string
required
Search term to find currencies (1-24 characters, letters, spaces, and parentheses only)

Validation Rules

  • Length: 1-24 characters
  • Allowed characters: A-Z, a-z, spaces, parentheses
  • Pattern: [^A-Za-z() ] (special characters not allowed)

Response

currencies
array
Array of matching currency objects
id
integer
Unique identifier for the currency
code
string
Three-letter currency code
fullName
string
Full name of the currency
sign
string
Currency symbol

Example Response

[
  {
    "id": 1,
    "code": "USD",
    "fullName": "United States Dollar",
    "sign": "$"
  }
]

Error Response

{
  "type": "https://tools.ietf.org/html/rfc7231#section-6.5.1",
  "title": "One or more validation errors occurred.",
  "status": 400,
  "errors": {
    "message": ["Не корректные символы в строке"]
  }
}

Create Currency

curl -X POST http://localhost:8080/api/Currency \
  -H "Content-Type: application/json" \
  -d '{
    "id": 0,
    "code": "JPY",
    "fullName": "Japanese Yen",
    "sign": "¥"
  }'
Creates a new currency in the system.

Request Body

id
integer
required
Currency ID (typically 0 for new currencies, auto-generated by database)
code
string
required
Three to five letter currency code (uppercase letters only)Validation:
  • Length: 3-5 characters
  • Pattern: A-Z only
  • Automatically converted to uppercase
fullName
string
required
Full name of the currencyValidation:
  • Length: 3-60 characters
  • Allowed: A-Z, a-z, А-Я, а-я, spaces, parentheses
sign
string
required
Currency symbolValidation:
  • Length: 1-3 characters
  • No whitespace or newlines allowed

Example Request

{
  "id": 0,
  "code": "JPY",
  "fullName": "Japanese Yen",
  "sign": "¥"
}

Response

currency
object
The created currency object
id
integer
Generated unique identifier
code
string
Currency code (uppercase)
fullName
string
Full name of the currency
sign
string
Currency symbol

Example Response

{
  "id": 4,
  "code": "JPY",
  "fullName": "Japanese Yen",
  "sign": "¥"
}

Error Responses

Empty or null field:
{
  "type": "https://tools.ietf.org/html/rfc7231#section-6.5.1",
  "title": "One or more validation errors occurred.",
  "status": 400,
  "errors": {
    "message": ["Не заполнен один или несколько параметров"]
  }
}
Invalid length:
{
  "type": "https://tools.ietf.org/html/rfc7231#section-6.5.1",
  "title": "One or more validation errors occurred.",
  "status": 400,
  "errors": {
    "message": ["Не корректное количество символов указано для поля USD валюты. Длина строки может быть от 3-х до 5 символов."]
  }
}
Invalid characters:
{
  "type": "https://tools.ietf.org/html/rfc7231#section-6.5.1",
  "title": "One or more validation errors occurred.",
  "status": 400,
  "errors": {
    "message": ["Не корректные символы в строке USD123."]
  }
}

Build docs developers (and LLMs) love