Contents
Duplicate View - Plugixa FAQ
POST /plugixa-faq/v1/views/{id}/duplicate
Copy a view. The copy is named “
Any signed-in user with the plugixa_faq_edit capability or WordPress’s edit_posts (Contributors and up, by default).
Request
POST https://your-site.example/wp-json/plugixa-faq/v1/views/2/duplicate
Path parameters
| Name | Type | Description |
|---|---|---|
id |
integer |
The view to copy’s id |
Responses
200 OK. data.id is the copy.
{
"success": true,
"message": "View duplicated successfully",
"data": {
"id": 3
}
}
| Field | Type | Meaning |
|---|---|---|
data.id |
integer |
The copy’s id |
message |
string |
A human-readable confirmation, translated to the site language |
Errors
| Status | Code | When |
|---|---|---|
404 |
rest_error |
No view with that id. |
500 |
rest_error |
The database refused the row. |
Plus the errors every endpoint can return.
Examples
curl -s -X POST "https://your-site.example/wp-json/plugixa-faq/v1/views/2/duplicate" \
-u "admin:$WP_APP_PASSWORD"
<?php
$ch = curl_init('https://your-site.example/wp-json/plugixa-faq/v1/views/2/duplicate');
curl_setopt_array($ch, [
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_USERPWD => 'admin:' . getenv('WP_APP_PASSWORD'),
]);
$response = json_decode(curl_exec($ch), true);
curl_close($ch);
const response = await fetch('https://your-site.example/wp-json/plugixa-faq/v1/views/2/duplicate', {
method: 'POST',
headers: {
'Authorization': 'Basic ' + btoa(`admin:${process.env.WP_APP_PASSWORD}`),
},
});
const { data } = await response.json();
Quick Links
Share