<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.qminder.com/input-fields",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'id' => '550e8400-e29b-41d4-a716-446655440000',
'location' => [
'id' => 12345
],
'type' => 'TEXT',
'title' => 'Reason for visit',
'isMandatoryBeforeAdded' => true,
'isMandatoryBeforeServed' => false,
'isMandatoryInRemoteSignIn' => false,
'isVisibleInWaitingDrawer' => true,
'isVisibleInServingDrawer' => true,
'showInRemoteSignIn' => true,
'visibleForLines' => [
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-Qminder-API-Version: <x-qminder-api-version>",
"X-Qminder-REST-API-Key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}