POST /wp-json/affinite-wp-watermark/v1/restore – Obnovení z backupu
Tento endpoint obnoví původní obrázky z backupu. Proces probíhá v dávkách.
Parametry (offset, limit)
| Parametr | Typ | Výchozí | Popis |
|---|---|---|---|
| offset | integer | 0 | Počet obrázků k přeskočení |
| limit | integer | 10 | Počet obrázků ke zpracování |
Response struktura
{
"success": true,
"restored": 10,
"failed": 0,
"skipped": 0,
"processed": 10,
"total": 100,
"completed": false
}
Příklady použití
async function restoreAllImages() {
let offset = 0;
const limit = 10;
let completed = false;
while (!completed) {
const response = await fetch('/wp-json/affinite-wp-watermark/v1/restore', {
method: 'POST',
headers: {
'X-WP-Nonce': wpApiSettings.nonce,
'Content-Type': 'application/json'
},
body: JSON.stringify({ offset, limit })
});
const data = await response.json();
if (data.success) {
offset = data.processed;
completed = data.completed;
console.log(`Restored ${data.restored} images`);
} else {
console.error('Error:', data.message);
break;
}
}
}
