Contents
On this page
Update Rate Providers - Plugixa Multi Currency for WooCommerce
PUT /plugixa-multi-currency/v1/pro/rates/providers
Save the provider list. Only what you send changes. PUT and POST work the same way.
Needs a user with the plugixa_multi_currency_manage_settings capability (signed in with an Application Password, or the login cookie with an X-WP-Nonce header). Administrators hold it; see Capabilities.
Note. Pro only: on the free plugin this route answers
404rest_no_route.
Request
PUT https://your-store.example/wp-json/plugixa-multi-currency/v1/pro/rates/providers
Request body
Content type: application/json
| Field | Type | Required | Description |
|---|---|---|---|
order |
string[] |
No | Provider ids in the order to try them. Providers you leave out follow, in their current order. |
enabled |
object |
No | Provider id to true or false. |
keys |
object |
No | Provider id to its API key. An empty string keeps the saved key; null removes it. Only for providers that need one. |
interval |
string |
No | 30min, hourly, 6h, daily or weekly. |
Keys are encrypted before they are saved when the site can encrypt (encryption). Changing interval reschedules the automatic update.
{
"order": ["openexchangerates", "ecb", "frankfurter"],
"enabled": {
"openexchangerates": true
},
"keys": {
"openexchangerates": "YOUR_APP_ID"
},
"interval": "hourly"
}
Responses
200 OK. data is the provider list as saved.
{
"success": true,
"data": {
"providers": [
{
"id": "openexchangerates",
"label": "Open Exchange Rates",
"enabled": true,
"needs_key": true,
"has_key": true,
"signup_url": "https://openexchangerates.org/signup"
},
{
"id": "ecb",
"label": "European Central Bank",
"enabled": true,
"needs_key": false,
"has_key": false,
"signup_url": ""
},
{
"id": "frankfurter",
"label": "Frankfurter (ECB mirror)",
"enabled": true,
"needs_key": false,
"has_key": false,
"signup_url": ""
},
"..."
],
"interval": "hourly",
"encryption": true
}
}
Fields as in List Rate Providers.
Errors
| Status | Code | When |
|---|---|---|
401 / 403 |
rest_forbidden |
The caller lacks the capability: Sorry, you are not allowed to do that. |
Plus the errors every endpoint can return.
Examples
curl -s -X PUT "https://your-store.example/wp-json/plugixa-multi-currency/v1/pro/rates/providers" \
-u "$WP_USER:$WP_APP_PASSWORD" \
-H "Content-Type: application/json" \
-d '{"order":["openexchangerates","ecb","frankfurter"],"enabled":{"openexchangerates":true},"keys":{"openexchangerates":"YOUR_APP_ID"},"interval":"hourly"}'
<?php
$ch = curl_init('https://your-store.example/wp-json/plugixa-multi-currency/v1/pro/rates/providers');
curl_setopt_array($ch, [
CURLOPT_CUSTOMREQUEST => 'PUT',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_USERPWD => getenv('WP_USER') . ':' . getenv('WP_APP_PASSWORD'),
CURLOPT_HTTPHEADER => ['Content-Type: application/json'],
CURLOPT_POSTFIELDS => json_encode([
'order' => ['openexchangerates', 'ecb', 'frankfurter'],
'enabled' => [
'openexchangerates' => true,
],
'keys' => [
'openexchangerates' => 'YOUR_APP_ID',
],
'interval' => 'hourly',
]),
]);
$response = json_decode(curl_exec($ch), true);
curl_close($ch);
const response = await fetch('https://your-store.example/wp-json/plugixa-multi-currency/v1/pro/rates/providers', {
method: 'PUT',
headers: {
'Authorization': `Basic ${btoa(`${process.env.WP_USER}:${process.env.WP_APP_PASSWORD}`)}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({ order: ['openexchangerates', 'ecb', 'frankfurter'], enabled: { openexchangerates: true }, keys: { openexchangerates: 'YOUR_APP_ID' }, interval: 'hourly' }),
});
const { data } = await response.json();
Quick Links
Share