Sample code for 30+ languages & platforms
B4X

GetHarvest - Delete Contact

See more GetHarvest Examples

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

Chilkat B4X Downloads

B4X
Dim success As Boolean = False

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

Dim http As ChilkatHttp
http.Initialize("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")

Dim resp As ChilkatHttpResponse
resp.Initialize
success = http.HttpNoBody("DELETE", "https://api.harvestapp.com/v2/contacts/CONTACT_ID", resp)
If success = False Then
    Log(http.LastErrorText)
    Return
End If


Dim respStatusCode As Int = resp.StatusCode
Log("Response Status Code = " & respStatusCode)
If respStatusCode <> 200 Then
    Log("Response Header:")
    Log(resp.Header)
    Log("Response Body:")
    Log(resp.BodyStr)
    Log("Failed.")
    Return
End If

Log("Success.")