Sample code for 30+ languages & platforms
Rust

Delete a Task List

See more Google Tasks Examples

Demonstrates how to delete a Google task list.

Chilkat Rust Downloads

Rust

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

// Get the previously obtained access token.
// See Get Google Tasks Access Token.

let fac = chilkat::FileAccess::new();
let Ok(access_token) = fac.read_entire_text_file("qa_data/tokens/googleTasks.txt", "utf-8") else {
    println!("{}", fac.last_error_text());
    return;
};

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

http.set_auth_token(&access_token);

// Delete the task list with this ID:  MDM4MzQ4NTA3NDQwMDUxMzQ2OTQ6OTk5Njk3NjkxNzg4Nzg2NDow
let _ = http.set_url_var("taskListId", "MDM4MzQ4NTA3NDQwMDUxMzQ2OTQ6OTk5Njk3NjkxNzg4Nzg2NDow");

let resp = chilkat::HttpResponse::new();
if http.http_no_body("DELETE", "https://www.googleapis.com/tasks/v1/users/@me/lists/{$taskListId}", &resp).is_err() {
    println!("{}", http.last_error_text());
    return;
}

// Show the response body. (empty for success)
println!("{}", resp.body_str());

// Examine the response status code. (204 = success)
println!("response status code: {}", resp.status_code());