Sample code for 30+ languages & platforms
Classic ASP

GetHarvest - Delete Contact

See more GetHarvest Examples

Delete a contact. Returns a 200 OK response code if the call succeeded.

Chilkat Classic ASP Downloads

Classic ASP
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
<%
success = 0

' This example assumes the Chilkat API to have been previously unlocked.
' See Global Unlock Sample for sample code.

set http = Server.CreateObject("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"

set resp = Server.CreateObject("Chilkat.HttpResponse")
success = http.HttpNoBody("DELETE","https://api.harvestapp.com/v2/contacts/CONTACT_ID",resp)
If (success = 0) Then
    Response.Write "<pre>" & Server.HTMLEncode( http.LastErrorText) & "</pre>"
    Response.End
End If

respStatusCode = resp.StatusCode
Response.Write "<pre>" & Server.HTMLEncode( "Response Status Code = " & respStatusCode) & "</pre>"
If (respStatusCode <> 200) Then
    Response.Write "<pre>" & Server.HTMLEncode( "Response Header:") & "</pre>"
    Response.Write "<pre>" & Server.HTMLEncode( resp.Header) & "</pre>"
    Response.Write "<pre>" & Server.HTMLEncode( "Response Body:") & "</pre>"
    Response.Write "<pre>" & Server.HTMLEncode( resp.BodyStr) & "</pre>"
    Response.Write "<pre>" & Server.HTMLEncode( "Failed.") & "</pre>"
    Response.End
End If

Response.Write "<pre>" & Server.HTMLEncode( "Success.") & "</pre>"

%>
</body>
</html>