Exchange rate (v1)

https://github.com/folio-org/mod-finance

Table of contents

Exchange rate API

This documents the API calls that can be made to get exchange rates

Exchange rate

Exchange rate API

GET /finance/exchange-rate

Get exchange rate

GET /finance/exchange-rate
Query Parameters
  • from: required (string)

    From currency code

    Example:

    USD
  • to: required (string)

    To currency code

    Example:

    EUR
  • lang: (string - default: en - pattern: [a-zA-Z]{2})

    Requested language. Optional. [lang=en]

Response 200

Exchange rate successfully retrieved

Body

Media type: application/json

Type: json

Content:

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "description": "Exchange rate schema",
  "type": "object",
  "properties": {
    "from": {
      "description": "From currency code",
      "$ref": "../../common/schemas/currency_code.json"
    },
    "to": {
      "description": "To currency code",
      "$ref": "../../common/schemas/currency_code.json"
    },
    "exchangeRate": {
      "description": "Exchange rate value",
      "type": "number"
    }
  },
  "additionalProperties": false,
  "required": [
    "from",
    "to",
    "exchangeRate"
  ]
}

Example:

sample

Response 400

Bad request, e.g. malformed request body or query parameter. Details of the error (e.g. name of the parameter or line/character number with malformed data) provided in the response.

Body

Media type: application/json

Type: json

Content:

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "description": "An error",
  "type": "object",
  "properties": {
    "message": {
      "type": "string",
      "description": "Error message text"
    },
    "type": {
      "type": "string",
      "description": "Error message type"
    },
    "code": {
      "type": "string",
      "description": "Error message code"
    },
    "parameters": {
      "type": "object",
      "description": "Error message parameters",
      "$ref": "parameters.schema"
    }
  },
  "required": [
    "message"
  ]
}

Example:

{
  "message": "may not be null",
  "type": "1",
  "code": "-1",
  "parameters": [
    {
      "key": "moduleTo",
      "value": "null"
    }
  ]
}

Response 404

Exchange rate is not available

Body

Media type: application/json

Type: json

Content:

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "description": "An error",
  "type": "object",
  "properties": {
    "message": {
      "type": "string",
      "description": "Error message text"
    },
    "type": {
      "type": "string",
      "description": "Error message type"
    },
    "code": {
      "type": "string",
      "description": "Error message code"
    },
    "parameters": {
      "type": "object",
      "description": "Error message parameters",
      "$ref": "parameters.schema"
    }
  },
  "required": [
    "message"
  ]
}

Example:

{
  "message": "may not be null",
  "type": "1",
  "code": "-1",
  "parameters": [
    {
      "key": "moduleTo",
      "value": "null"
    }
  ]
}

Response 500

Internal server error, e.g. due to misconfiguration

Body

Media type: application/json

Type: json

Content:

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "description": "An error",
  "type": "object",
  "properties": {
    "message": {
      "type": "string",
      "description": "Error message text"
    },
    "type": {
      "type": "string",
      "description": "Error message type"
    },
    "code": {
      "type": "string",
      "description": "Error message code"
    },
    "parameters": {
      "type": "object",
      "description": "Error message parameters",
      "$ref": "parameters.schema"
    }
  },
  "required": [
    "message"
  ]
}

Example:

{
  "message": "may not be null",
  "type": "1",
  "code": "-1",
  "parameters": [
    {
      "key": "moduleTo",
      "value": "null"
    }
  ]
}