Contents
On this page
Import Settings - Plugixa Multi Currency for WooCommerce
POST /plugixa-multi-currency/v1/transfer/import
Load a file made by Export Settings. Each part is saved through the same routes the screens use, so the same checks apply.
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
POST https://your-store.example/wp-json/plugixa-multi-currency/v1/transfer/import
Request body
Content type: application/json
| Field | Type | Required | Description |
|---|---|---|---|
file |
object |
Yes | The settings file, as exported. |
dry_run |
boolean |
No | true reports what would change and saves nothing. Defaults to false. |
Currencies are added or updated, never deleted. When the file’s store_currency differs from this store’s, the currencies are left out, because every rate is relative to the store currency; the other parts are still loaded.
{
"file": {
"format": "plugixa-multi-currency-settings",
"store_currency": "USD",
"settings": {
"auto_rates": true
},
"currencies": {
"EUR": {
"rate": "0.9099181073",
"margin_pct": "1"
}
},
"sections": {
"seo": {
"enabled": true
}
}
},
"dry_run": true
}
Responses
200 OK, even when some parts failed: read ok.
{
"success": true,
"data": {
"ok": true,
"report": [
{
"section": "settings",
"status": "ready",
"message": "1 settings"
},
{
"section": "currencies",
"status": "ready",
"message": "0 added, 1 updated."
},
{
"section": "seo",
"status": "ready",
"message": "Currency URLs"
}
]
}
}
| Field | Type | Meaning |
|---|---|---|
ok |
boolean |
false when any line has the status error |
report |
object[] |
One line per part: section, status (ready in a dry run, done, skipped or error) and message |
Messages include This is not a Plugixa Multi Currency settings file. (status error, nothing loaded), This site does not have that feature (Pro, or the module is off). (skipped) and Refused: GBP. for currencies that did not pass the checks.
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 POST "https://your-store.example/wp-json/plugixa-multi-currency/v1/transfer/import" \
-u "$WP_USER:$WP_APP_PASSWORD" \
-H "Content-Type: application/json" \
-d '{"file":{"format":"plugixa-multi-currency-settings","store_currency":"USD","settings":{"auto_rates":true},"currencies":{"EUR":{"rate":"0.9099181073","margin_pct":"1"}},"sections":{"seo":{"enabled":true}}},"dry_run":true}'
<?php
$ch = curl_init('https://your-store.example/wp-json/plugixa-multi-currency/v1/transfer/import');
curl_setopt_array($ch, [
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_USERPWD => getenv('WP_USER') . ':' . getenv('WP_APP_PASSWORD'),
CURLOPT_HTTPHEADER => ['Content-Type: application/json'],
CURLOPT_POSTFIELDS => json_encode([
'file' => [
'format' => 'plugixa-multi-currency-settings',
'store_currency' => 'USD',
'settings' => [
'auto_rates' => true,
],
'currencies' => [
'EUR' => [
'rate' => '0.9099181073',
'margin_pct' => '1',
],
],
'sections' => [
'seo' => [
'enabled' => true,
],
],
],
'dry_run' => true,
]),
]);
$response = json_decode(curl_exec($ch), true);
curl_close($ch);
const response = await fetch('https://your-store.example/wp-json/plugixa-multi-currency/v1/transfer/import', {
method: 'POST',
headers: {
'Authorization': `Basic ${btoa(`${process.env.WP_USER}:${process.env.WP_APP_PASSWORD}`)}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({ file: { format: 'plugixa-multi-currency-settings', store_currency: 'USD', settings: { auto_rates: true }, currencies: { EUR: { rate: '0.9099181073', margin_pct: '1' } }, sections: { seo: { enabled: true } } }, dry_run: true }),
});
const { data } = await response.json();
Quick Links
Share