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
| Parameter | Type | Description |
|---|---|---|
id | String | Required. The ID of the exchange rate record to update. |
Request Body
The request body is a JSON object with the following fields:
| Field | Type | Required | Description |
|---|---|---|---|
baseCurrency | String | Yes | Currency the rates convert from. |
updatedAt | String | Yes | Date and time of the rates (ISO 8601). |
rates | Array | No | Conversion 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
successto 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
| Field | Type | Description |
|---|---|---|
success | Boolean | Whether the record was updated. |
message | String | Result message. |
data | Object | The updated record. See Exchange Rate Data. |
Notes
- If no record matches the ID,
successisfalseandmessageisExchangeRate not found.