Contents
On this page

Set Default View - Plugixa FAQ

POST /plugixa-faq/v1/views/{id}/set-default

Make a view the one used when a shortcode or block names none.

Any signed-in user with the plugixa_faq_edit capability or WordPress’s edit_posts (Contributors and up, by default).

Note. The previous default loses its flag first. With an id that matches no view the call still answers 200, and the site is left with no default view.

Request

POST https://your-site.example/wp-json/plugixa-faq/v1/views/2/set-default

Path parameters

Name Type Description
id integer The view’s id

Responses

200 OK.

{
  "success": true,
  "message": "Default view updated successfully",
  "data": {
    "id": 2
  }
}
Field Type Meaning
data.id integer The id from the path
message string A human-readable confirmation, translated to the site language

Errors

Status Code When
500 rest_error The database refused the change.

Plus the errors every endpoint can return.

Examples

curl -s -X POST "https://your-site.example/wp-json/plugixa-faq/v1/views/2/set-default" \
  -u "admin:$WP_APP_PASSWORD"
<?php
$ch = curl_init('https://your-site.example/wp-json/plugixa-faq/v1/views/2/set-default');
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/set-default', {
  method: 'POST',
  headers: {
    'Authorization': 'Basic ' + btoa(`admin:${process.env.WP_APP_PASSWORD}`),
  },
});
const { data } = await response.json();

Quick Links

Share