<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_PORT => "3001",
CURLOPT_URL => "http://localhost:3001/portal-api/extended_attributes/{extended_attribute_id}/custom-attributes/{custom_attribute_id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'Name' => 'Terms of use',
'Identifier' => 'terms-of-use',
'Description' => 'I have read and agreed with...',
'Behaviour' => 3,
'DropdownValues' => 'Fleet_management,Cities,EV_management',
'ValidationRegExp' => 'www\\.[a-zA-Z0-9]+\\.[a-zA-Z0-9]+',
'AddToKeyMetadata' => true,
'Required' => true,
'ShowOnSignUp' => true,
'WriteOnceReadMany' => true
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}