Contents
On this page
Update View - Plugixa FAQ
PUT /plugixa-faq/v1/views/{id}
Change a view’s name, slug, description or design.
Any signed-in user with the plugixa_faq_edit capability or WordPress’s edit_posts (Contributors and up, by default).
Note.
name,sluganddescriptionchange only when sent, but two things are replaced:configis rebuilt from the defaults plus what you send, so sections you leave out go back to their defaults; andis_defaultis always written, asfalsewhen omitted, so updating the default view without"is_default": trueleaves the site with no default view. Send the wholeconfigfrom Get View, andis_defaulttoo. There is no existence check: an id that matches nothing still answers200with the success message, and nothing changes.
Request
PUT https://your-site.example/wp-json/plugixa-faq/v1/views/2
Path parameters
| Name | Type | Description |
|---|---|---|
id |
integer |
The view’s id |
Request body
Content type: application/json
| Field | Type | Required | Description |
|---|---|---|---|
name |
string |
No | At least 2 characters. |
slug |
string |
No | Made from the name when empty, and then made unique. A slug you send must not be taken already. |
description |
string |
No | Plain text. |
config |
object |
No | The design, in the shape Get View returns. Merged over the defaults, so you can send only the sections you change. layout.style must be a layout available on the site: accordion and list, plus timeline and horizontal with Pro. |
is_default |
boolean |
No | true makes this the default view and clears the flag on the previous one. Defaults to false. |
{
"name": "Support centre",
"config": {
"layout": {
"style": "accordion",
"columns": 1,
"groupByCategory": false
},
"behavior": {
"openFirst": false,
"allowMultiple": true,
"animationSpeed": 300
},
"icon": {
"style": "chevron",
"position": "right"
},
"colors": {
"questionText": "#1d2327",
"questionBg": "#f0f0f1",
"answerText": "#1d2327",
"answerBg": "#ffffff",
"borderColor": "#c3c4c7",
"accentColor": "#2271b1"
},
"typography": {
"questionFontSize": 16,
"questionFontWeight": 600,
"answerFontSize": 14,
"answerFontWeight": 400
},
"spacing": {
"padding": 15,
"margin": 10,
"gap": 8
},
"borders": {
"radius": 4,
"width": 1
},
"shadows": {
"enabled": false,
"value": "0 2px 4px rgba(0,0,0,0.1)"
},
"feedback": {
"enabled": false
}
},
"is_default": false
}
Responses
200 OK.
{
"success": true,
"message": "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 |
|---|---|---|
400 |
invalid_layout |
config.layout.style is not available on this site. |
400 |
rest_error |
“Validation failed”: the name is empty or shorter than 2 characters, or the slug belongs to another view. |
500 |
rest_error |
The database refused the change. |
Plus the errors every endpoint can return.
Examples
curl -s -X PUT "https://your-site.example/wp-json/plugixa-faq/v1/views/2" \
-u "admin:$WP_APP_PASSWORD" \
-H "Content-Type: application/json" \
-d '{"name":"Support centre","config":{"layout":{"style":"accordion","columns":1,"groupByCategory":false},"behavior":{"openFirst":false,"allowMultiple":true,"animationSpeed":300},"icon":{"style":"chevron","position":"right"},"colors":{"questionText":"#1d2327","questionBg":"#f0f0f1","answerText":"#1d2327","answerBg":"#ffffff","borderColor":"#c3c4c7","accentColor":"#2271b1"},"typography":{"questionFontSize":16,"questionFontWeight":600,"answerFontSize":14,"answerFontWeight":400},"spacing":{"padding":15,"margin":10,"gap":8},"borders":{"radius":4,"width":1},"shadows":{"enabled":false,"value":"0 2px 4px rgba(0,0,0,0.1)"},"feedback":{"enabled":false}},"is_default":false}'
<?php
$ch = curl_init('https://your-site.example/wp-json/plugixa-faq/v1/views/2');
curl_setopt_array($ch, [
CURLOPT_CUSTOMREQUEST => 'PUT',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_USERPWD => 'admin:' . getenv('WP_APP_PASSWORD'),
CURLOPT_HTTPHEADER => ['Content-Type: application/json'],
CURLOPT_POSTFIELDS => json_encode([
'name' => 'Support centre',
'config' => [
'layout' => [
'style' => 'accordion',
'columns' => 1,
'groupByCategory' => false,
],
'behavior' => [
'openFirst' => false,
'allowMultiple' => true,
'animationSpeed' => 300,
],
'icon' => [
'style' => 'chevron',
'position' => 'right',
],
'colors' => [
'questionText' => '#1d2327',
'questionBg' => '#f0f0f1',
'answerText' => '#1d2327',
'answerBg' => '#ffffff',
'borderColor' => '#c3c4c7',
'accentColor' => '#2271b1',
],
'typography' => [
'questionFontSize' => 16,
'questionFontWeight' => 600,
'answerFontSize' => 14,
'answerFontWeight' => 400,
],
'spacing' => [
'padding' => 15,
'margin' => 10,
'gap' => 8,
],
'borders' => [
'radius' => 4,
'width' => 1,
],
'shadows' => [
'enabled' => false,
'value' => '0 2px 4px rgba(0,0,0,0.1)',
],
'feedback' => [
'enabled' => false,
],
],
'is_default' => false,
]),
]);
$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', {
method: 'PUT',
headers: {
'Authorization': 'Basic ' + btoa(`admin:${process.env.WP_APP_PASSWORD}`),
'Content-Type': 'application/json',
},
body: JSON.stringify({ name: 'Support centre', config: { layout: { style: 'accordion', columns: 1, groupByCategory: false }, behavior: { openFirst: false, allowMultiple: true, animationSpeed: 300 }, icon: { style: 'chevron', position: 'right' }, colors: { questionText: '#1d2327', questionBg: '#f0f0f1', answerText: '#1d2327', answerBg: '#ffffff', borderColor: '#c3c4c7', accentColor: '#2271b1' }, typography: { questionFontSize: 16, questionFontWeight: 600, answerFontSize: 14, answerFontWeight: 400 }, spacing: { padding: 15, margin: 10, gap: 8 }, borders: { radius: 4, width: 1 }, shadows: { enabled: false, value: '0 2px 4px rgba(0,0,0,0.1)' }, feedback: { enabled: false } }, is_default: false }),
});
const { data } = await response.json();
Quick Links
Share