The Update currency rates method is used to update exchange currency rates for the current reseller or any of its downstream resellers:
-
For the list of available currencies, see Get list of currency rates.
-
You can update several currency rates at once.
-
If the same currency pair is specified several times in a request, the currency rate is updated sequentially several times.
Currency rates and adjustment coefficients are automatically updated for every reseller on all downstream levels if a downstream reseller did not specify custom values. By default, all currency rates and adjustment coefficients are equal to 1. For details, see Managing currency rates.
PATCH {{base_url}}/api/v3/resellers/{{reseller_id}}/currency_rates
Authentication
This endpoint requires a JWT access token. Specify the token in the Authorization header using the Bearer authentication scheme:
Authorization: Bearer <JWT_ACCESS_TOKEN>
In Postman, select Bearer Token on the Authorization tab and enter the JWT access token.
Arguments
|
Name |
Parameter type |
Data type |
Required/Optional |
Description |
|---|---|---|---|---|
|
Content-Type |
header |
string |
Required |
Media type of the request. Specify the following: application/vnd.api+json |
|
Accept |
header |
string |
Required |
Supported media types of the answer. Specify the following: application/vnd.api+json |
|
base_url |
path |
string |
Required |
ActivePlatform URL |
|
reseller_id |
path |
integer |
Required |
The ID of the current reseller or any of its downstream resellers (see Viewing and updating reseller general information) |
|
base_currency |
form |
string |
Required |
The ISO 4217:2008 code of a currency, in relation to which the exchange rate is updated. For example, the reseller's currency |
|
foreign_currency |
form |
string |
Required |
The ISO 4217:2008 code of a currency, the exchange rate of which is being updated. For example, the currency of a plan |
|
quantity |
form |
integer |
Required |
Number of currency units used for a currency rate |
|
rate |
form |
number |
Required |
The new currency rate for the specified |
|
adjustment |
form |
number |
Optional |
The new adjustment value for customers — the coefficient by which the currency rate is multiplied (from 0.0001 to 1000) |
|
show_for_client |
form |
bool |
Optional |
Indicates whether a currency rate is displayed in the Customer Control Panel (see Screen layout):
|
Response model
|
Name |
Data type |
Description |
|||
|---|---|---|---|---|---|
|
data |
array of objects |
Response data |
|||
|
|
id |
string |
ID of the currency rate |
||
|
|
type |
string |
Data type |
||
|
|
attributes |
object |
Attributes of the currency rates set for the reseller currency |
||
|
|
|
created_at |
string |
Date and time of the currency rates creation |
|
|
|
|
updated_at |
string |
Date and time when the currency rates were updated |
|
|
|
|
from_id |
string |
The ID of a currency, the exchange rate of which is set. Corresponds to |
|
|
|
|
to_id |
string |
The ID of a currency, in relation to which the exchange rate is set. Corresponds to |
|
|
|
|
rate |
string |
Currency rate for the specified |
|
|
|
|
quantity |
integer |
Number of currency units used for a currency rate |
|
|
|
|
current |
bool |
Indicates whether the value is a current currency rate. Always returns true |
|
|
|
|
reseller_id |
integer |
The reseller ID |
|
|
|
|
show_for_client |
bool |
Indicates whether a currency rate is displayed in the Customer Control Panel (see Screen layout):
|
|
Request example
PATCH /api/v3/resellers/1/currency_rates
Host: test.activeplatform.com
Content-Type: application/vnd.api+json
Authorization: Bearer <JWT_ACCESS_TOKEN>
Accept: application/vnd.api+json
JSON
{
"data": {
"attributes": [
{
"base_currency": "USD",
"foreign_currency": "EUR",
"quantity": 1,
"rate": 1.2200,
"adjustment": 1.2000,
"show_for_client": true
},
{
"base_currency": "USD",
"foreign_currency": "MYR",
"quantity": 100,
"rate": 1.43,
"adjustment": 1.1100,
"show_for_client": true
}
]
}
}
Response example
{
"data": [
{
"id": "606",
"type": "currency_rates",
"attributes": {
"created_at": "2024-10-04T16:23:46.198+03:00",
"updated_at": "2024-10-04T16:23:46.198+03:00",
"from_id": 2,
"to_id": 1,
"rate": "1.22",
"quantity": 1,
"current": true,
"reseller_id": 1,
"show_for_client": true,
"adjustment": "1.2"
}
},
{
"id": "607",
"type": "currency_rates",
"attributes": {
"created_at": "2024-10-04T16:23:46.235+03:00",
"updated_at": "2024-10-04T16:23:46.235+03:00",
"from_id": 4,
"to_id": 1,
"rate": "1.43",
"quantity": 100,
"current": true,
"reseller_id": 1,
"show_for_client": true,
"adjustment": "1.11"
}
}
]
}