Sample code for 30+ languages & platforms
Rust

GetHarvest - Delete Contact

See more GetHarvest Examples

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

Chilkat Rust Downloads

Rust

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

let http = chilkat::Http::new();

// 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.set_request_header("User-Agent", "MyApp (yourname@example.com)");
http.set_request_header("Authorization", "Bearer ACCESS_TOKEN");
http.set_request_header("Harvest-Account-Id", "ACCOUNT_ID");

let resp = chilkat::HttpResponse::new();
if http.http_no_body("DELETE", "https://api.harvestapp.com/v2/contacts/CONTACT_ID", &resp).is_err() {
    println!("{}", http.last_error_text());
    return;
}

let resp_status_code = resp.status_code();
println!("Response Status Code = {}", resp_status_code);
if resp_status_code != 200 {
    println!("Response Header:");
    println!("{}", resp.header());
    println!("Response Body:");
    println!("{}", resp.body_str());
    println!("Failed.");
    return;
}

println!("Success.");