Hi t ried to add contact using curl ad got the error:
Array ( [message] => Input could not be converted to a valid request )
following is the code im using:
$data = array ( "duplicate_option" => "Email",
"email_addresses" => array (
"email" => "testrest2@live.com",
"field" => "EMAIL1"
)
);
$parameters = json_encode($data, true);
//var_dump ($parameters);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://api.infusionsoft.com/crm/rest/v1/contacts?access_token=$atoken");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($ch, CURLOPT_HEADER, FALSE);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
"content-type:application/json;charset=UTF-8",
"Accept:application/json, */*",
));
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $parameters);
$response = curl_exec($ch);
$info = curl_getinfo($ch);
curl_close($ch);
//HTTP header response code
$responsecode = $info['http_code'];
$json = json_decode($response, JSON_PRETTY_PRINT);
print_r($json);