Contents
On this page

Lead Answers - Plugixa Chat

GET /plugixa-chat/v1/leads/{id}/answers

Read what the visitor answered in the custom form fields PRO of the contact form.

Needs Plugixa Chat Pro, with custom form fields switched on. The signed-in user needs the plugixa_chat_view capability. Administrators have it.

Note. An id with no answers, including one that is not a lead at all, answers 200 with an empty list rather than 404.

Request

GET https://your-site.example/wp-json/plugixa-chat/v1/leads/41/answers

Path parameters

Name Type Description
id integer The lead’s id

Responses

200 OK. data is the list of answers, in the form’s order.

{
  "success": true,
  "data": [
    {
      "key": "f1",
      "label": "Company",
      "value": "Acme"
    },
    {
      "key": "f2",
      "label": "Budget",
      "value": "1000-5000"
    }
  ]
}
Field Type Meaning
data[].key string The field’s key: f1, f2 and so on
data[].label string The field’s label when the lead was sent
data[].value string The answer

Errors

Plus the errors every endpoint can return.

Examples

curl -s "https://your-site.example/wp-json/plugixa-chat/v1/leads/41/answers" \
  -u "admin:$WP_APP_PASSWORD"
<?php
$ch = curl_init('https://your-site.example/wp-json/plugixa-chat/v1/leads/41/answers');
curl_setopt_array($ch, [
    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-chat/v1/leads/41/answers', {
  headers: {
    'Authorization': 'Basic ' + btoa(`admin:${process.env.WP_APP_PASSWORD}`),
  },
});
const { data } = await response.json();

Quick Links

Share