Contents
Delete Several Views - Plugixa Testimonial
DELETE /plugixatestimonial/v1/views/bulk
Delete several views for good in one request. The default view is skipped.
Any signed-in user with the plugixa_testimonial_delete capability or WordPress’s delete_others_posts (Editors and Administrators, by default).
Request
DELETE https://your-site.example/wp-json/plugixatestimonial/v1/views/bulk
Request body
Content type: application/json
| Field | Type | Required | Description |
|---|---|---|---|
ids |
integer[] |
Yes | View ids. The default view’s id is left out silently. |
{
"ids": [
2,
9
]
}
Responses
200 OK.
{
"success": true,
"message": "2 views deleted successfully",
"data": {
"deleted": 2
}
}
| Field | Type | Meaning |
|---|---|---|
data.deleted |
integer |
Views actually deleted |
message |
string |
A human-readable confirmation, translated to the site language |
Errors
| Status | Code | When |
|---|---|---|
400 |
rest_error |
“No IDs provided” |
403 |
rest_error |
“Cannot delete the default view.”: the only id sent was the default view. |
Plus the errors every endpoint can return.
Examples
curl -s -X DELETE "https://your-site.example/wp-json/plugixatestimonial/v1/views/bulk" \
-u "admin:$WP_APP_PASSWORD" \
-H "Content-Type: application/json" \
-d '{"ids":[2,9]}'
<?php
$ch = curl_init('https://your-site.example/wp-json/plugixatestimonial/v1/views/bulk');
curl_setopt_array($ch, [
CURLOPT_CUSTOMREQUEST => 'DELETE',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_USERPWD => 'admin:' . getenv('WP_APP_PASSWORD'),
CURLOPT_HTTPHEADER => ['Content-Type: application/json'],
CURLOPT_POSTFIELDS => json_encode([
'ids' => [2, 9],
]),
]);
$response = json_decode(curl_exec($ch), true);
curl_close($ch);
const response = await fetch('https://your-site.example/wp-json/plugixatestimonial/v1/views/bulk', {
method: 'DELETE',
headers: {
'Authorization': 'Basic ' + btoa(`admin:${process.env.WP_APP_PASSWORD}`),
'Content-Type': 'application/json',
},
body: JSON.stringify({ ids: [2, 9] }),
});
const { data } = await response.json();
Quick Links
Share