[ 'method' => 'POST', 'header' => "Content-Type: application/x-www-form-urlencoded\r\n", 'content' => http_build_query($query), 'ignore_errors' => true, ], ]; $ctx = stream_context_create($opts); $raw = file_get_contents($url, false, $ctx); if ($raw === false) { return ['ok' => false, 'error' => 'Request failed']; } $decoded = json_decode($raw, true); return is_array($decoded) ? $decoded : ['ok' => false, 'error' => 'Invalid JSON', 'raw' => $raw]; } $message = null; if ($_SERVER['REQUEST_METHOD'] === 'POST') { $op = $_POST['fixture_op'] ?? ''; if ($op === 'save_mailshot') { $payload = [ 'op' => 'save', 'id' => $_POST['id'] ?? '', 'Purpose' => $_POST['Purpose'] ?? '', 'DataSource' => $_POST['DataSource'] ?? '', 'Subject' => $_POST['Subject'] ?? '', 'Message' => $_POST['Message'] ?? '', 'AttachmentNames' => $_POST['AttachmentNames'] ?? '[]', 'PDFAttachment' => $_POST['PDFAttachment'] ?? '', 'PDFFilenameDerivedFrom' => $_POST['PDFFilenameDerivedFrom'] ?? '', 'ReplyTo' => $_POST['ReplyTo'] ?? '', ]; $message = call_api('admin_post_feca_mailshots_mailshots_api', $payload); } if ($op === 'delete_mailshot') { $message = call_api('admin_post_feca_mailshots_mailshots_api', ['op' => 'delete', 'id' => $_POST['id'] ?? '0']); } } $dataSources = call_api('admin_post_feca_mailshots_mailshots_api', ['op' => 'data_sources']); $mailshots = call_api('admin_post_feca_mailshots_mailshots_api', ['op' => 'list']); ?> Mailshots Fixture UI

Mailshots Fixture UI

API response

Create / Update Mailshot

Current Mailshots

IDPurposeDataSourceSubjectDelete