I am using the clinch-pad rest api to create the contact using this document
Document rest api
I i am trying bellow snippet code to create contact on clinchpad but its getting error We're sorry, but something went wrong..
so can any one tell me how do i go to achieve this.
$url = 'https://www.clinchpad.com/api/v1/contacts';
//$appId = 'YOUR_APP_ID';
$restKey = 'MY_API_KEY';
$headers = array(
"Content-Type: application/json",
//"X-Parse-Application-Id: " . $appId,
"X-Parse-REST-API-Key: " . $restKey
//"-u api-key:". $restKey
);
$objectData = '{
"_id": "521f2wwww6eccce8b4310e000076",
"name": "wwwwwwwwFoo Guy",
"designation": null,
"email": "[email protected]",
"phone": "5553331234",
"address": null,
"fields": [
{
"_id": "531ed3a49a21f6e90b00000e",
"name": "custom contact field",
"value": "Annual"
}
],
"organization": {
"_id": "sdfsdf5455sdfdf545455",
"name": "Foo Organization",
"email": "[email protected]",
"phone": "5553336666",
"website": "http://www.foocorp.com",
"address": "Foo City"
}
},
';
$rest = curl_init();
curl_setopt($rest,CURLOPT_URL,$url);
curl_setopt($rest,CURLOPT_POST,1);
curl_setopt($rest,CURLOPT_POSTFIELDS,$objectData);
curl_setopt($rest,CURLOPT_HTTPHEADER,$headers);
curl_setopt($rest,CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($rest,CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($rest);
echo $response;
print_r($response);
curl_close($rest);