I am using a client management software called UCRM. The API I am using is meant to patch/update but it seems to make new entries when it comes to the contacts array.
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "http://url.com" . $clientID);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($ch, CURLOPT_HEADER, FALSE);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "PATCH");
curl_setopt($ch, CURLOPT_POSTFIELDS, "{
\"contacts\": [
{
\"phone\": \"" . $pendingTo . "\"
}
]
}");
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
"Content-Type: application/json",
"X-Auth-App-Key: 12345"
));
$response = curl_exec($ch);
curl_close($ch);
I can't figure out how to make it update the existing phone number in the contacts array. The code above seems to add to the array.