Skip to main content

Update Exchange Rate

Updates an exchange rate record.

HTTP Request​

  • URL: /exchangeRate/update/{id}
  • Method: PUT
  • Headers:
    • accessToken: Required. Your API access token.
    • Content-Type: application/json
  • Required scope: READ_WRITE_EXCHANGE_RATE

Path Parameters​

ParameterTypeDescription
idStringRequired. The ID of the exchange rate record to update.

Request Body​

The request body is a JSON object with the following fields:

FieldTypeRequiredDescription
baseCurrencyStringYesCurrency the rates convert from.
updatedAtStringYesDate and time of the rates (ISO 8601).
ratesArrayNoConversion rates. Replaces the current list. Each rate has currency (String) and rate (Number).

cURL Example​

curl --location --request PUT '<BASE_URL>/exchangeRate/update/66f1a2b3c4d5e6f708192a3b' \
--header 'accessToken: <ACCESS_TOKEN>' \
--header 'Content-Type: application/json' \
--data '{
"baseCurrency": "USD",
"updatedAt": "2024-10-14T09:00:00.000Z",
"rates": [
{ "currency": "EUR", "rate": 0.9198 },
{ "currency": "GBP", "rate": 0.7701 }
]
}'

Response​

  • 200 OK: The request was processed. Check success to see whether the record was updated.
  • 400 Bad Request: The access token is missing or invalid, the token does not have the required scope, or a field is missing or not valid.

Sample JSON Response​

{
"success": true,
"message": "ExchangeRate updated Successfully",
"data": {
"_id": "66f1a2b3c4d5e6f708192a3b",
"baseCurrency": "USD",
"rates": [
{ "_id": "670cf3e1b3c4d5e6f708193a", "currency": "EUR", "rate": 0.9198 },
{ "_id": "670cf3e1b3c4d5e6f708193b", "currency": "GBP", "rate": 0.7701 }
],
"updatedAt": "2024-10-14T09:12:44.317Z",
"createdAt": "2024-09-23T17:41:07.902Z",
"id": "66f1a2b3c4d5e6f708192a3b"
}
}

Response Details​

FieldTypeDescription
successBooleanWhether the record was updated.
messageStringResult message.
dataObjectThe updated record. See Exchange Rate Data.

Notes​

  • If no record matches the ID, success is false and message is ExchangeRate not found.