Contents
On this page
Update A/B Test - Plugixa Chat
PUT /plugixa-chat/v1/experiments/{id}
Change a test. PUT and PATCH behave the same.
Needs Plugixa Chat Pro. The signed-in user needs the plugixa_chat_edit capability. Administrators have it.
Note. A draft is fully replaced:
name,widget_aandwidget_bare required, and a missingsplitgoes back to50. Once the test has started, onlynamecan change; everything else you send is ignored without an error.
Request
PUT https://your-site.example/wp-json/plugixa-chat/v1/experiments/7
Path parameters
| Name | Type | Description |
|---|---|---|
id |
integer |
The test’s id |
Request body
Content type: application/json
| Field | Type | Required | Description |
|---|---|---|---|
name |
string |
Yes | Up to 191 characters. |
widget_a |
integer |
Yes | An existing widget, not in the trash. |
widget_b |
integer |
Yes | Another existing widget. |
split |
integer |
No | Percentage of visitors shown widget A, 10 to 90. Defaults to 50. |
{
"name": "Green button or blue button",
"widget_a": 2,
"widget_b": 5,
"split": 50
}
Responses
200 OK. data is the updated test.
{
"success": true,
"data": {
"id": 7,
"name": "Green button or blue button",
"widget_a": 2,
"widget_b": 5,
"split": 50,
"status": "draft",
"started_at": null,
"ended_at": null,
"winner_id": 0,
"deleted_at": null,
"created_at": "2026-11-12 09:30:00",
"modified_at": "2026-11-12 09:30:00",
"created_by": "1",
"modified_by": "1"
}
}
| Field | Type | Meaning |
|---|---|---|
data.id |
integer |
The test’s id |
data.widget_a, data.widget_b |
integer |
The two widgets compared |
data.split |
integer |
Percentage of visitors shown widget A. The rest see B |
data.status |
string |
draft, running or ended |
Errors
| Status | Code | When |
|---|---|---|
404 |
plugixa_chat_test_missing |
No test has this id, or it is in the trash. |
400 |
plugixa_chat_test_name |
name is missing or blank. |
400 |
plugixa_chat_test_widgets |
A widget is missing, does not exist or is in the trash. |
400 |
plugixa_chat_test_same |
widget_a and widget_b are the same widget. |
409 |
plugixa_chat_test_busy |
One of the widgets is already in a running test. |
Plus the errors every endpoint can return.
Examples
curl -s -X PUT "https://your-site.example/wp-json/plugixa-chat/v1/experiments/7" \
-u "admin:$WP_APP_PASSWORD" \
-H "Content-Type: application/json" \
-d '{"name":"Green button or blue button","widget_a":2,"widget_b":5,"split":50}'
<?php
$ch = curl_init('https://your-site.example/wp-json/plugixa-chat/v1/experiments/7');
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' => 'Green button or blue button',
'widget_a' => 2,
'widget_b' => 5,
'split' => 50,
]),
]);
$response = json_decode(curl_exec($ch), true);
curl_close($ch);
const response = await fetch('https://your-site.example/wp-json/plugixa-chat/v1/experiments/7', {
method: 'PUT',
headers: {
'Authorization': 'Basic ' + btoa(`admin:${process.env.WP_APP_PASSWORD}`),
'Content-Type': 'application/json',
},
body: JSON.stringify({ name: 'Green button or blue button', widget_a: 2, widget_b: 5, split: 50 }),
});
const { data } = await response.json();
Quick Links
Share