(PHP ActiveX) GetHarvest - Delete Contact
Delete a contact. Returns a 200 OK response code if the call succeeded. For more information, see https://help.getharvest.com/api-v2/clients-api/clients/contacts/
<?php
// This example assumes the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
// For versions of Chilkat < 10.0.0, use new COM('Chilkat_9_5_0.Chilkat.Http')
$http = new COM("Chilkat.Http");
// Implements the following CURL command:
// curl "https://api.harvestapp.com/v2/contacts/CONTACT_ID" \
// -H "Authorization: Bearer ACCESS_TOKEN" \
// -H "Harvest-Account-Id: ACCOUNT_ID" \
// -H "User-Agent: MyApp (yourname@example.com)" \
// -X DELETE
$http->SetRequestHeader('User-Agent','MyApp (yourname@example.com)');
$http->SetRequestHeader('Authorization','Bearer ACCESS_TOKEN');
$http->SetRequestHeader('Harvest-Account-Id','ACCOUNT_ID');
// resp is a Chilkat.HttpResponse
$resp = $http->QuickRequest('DELETE','https://api.harvestapp.com/v2/contacts/CONTACT_ID');
if ($http->LastMethodSuccess == 0) {
print $http->LastErrorText . "\n";
exit;
}
$respStatusCode = $resp->StatusCode;
print 'Response Status Code = ' . $respStatusCode . "\n";
if ($respStatusCode != 200) {
print 'Response Header:' . "\n";
print $resp->Header . "\n";
print 'Response Body:' . "\n";
print $resp->BodyStr . "\n";
print 'Failed.' . "\n";
exit;
}
print 'Success.' . "\n";
?>
|