Lua
Lua
Delete a Task List
See more Google Tasks Examples
Demonstrates how to delete a Google task list.Chilkat Lua Downloads
local chilkat = require("chilkat")
-- 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.
local fac = chilkat.FileAccess.new()
local accessToken = fac:read_entire_text_file("qa_data/tokens/googleTasks.txt", "utf-8")
if not fac.last_method_success then
print(fac.last_error_text)
return
end
local http = chilkat.Http.new()
http.auth_token = accessToken
-- Delete the task list with this ID: MDM4MzQ4NTA3NDQwMDUxMzQ2OTQ6OTk5Njk3NjkxNzg4Nzg2NDow
http:set_url_var("taskListId", "MDM4MzQ4NTA3NDQwMDUxMzQ2OTQ6OTk5Njk3NjkxNzg4Nzg2NDow")
local resp = chilkat.HttpResponse.new()
local success = http:http_no_body("DELETE", "https://www.googleapis.com/tasks/v1/users/@me/lists/{$taskListId}", resp)
if not success then
print(http.last_error_text)
return
end
-- Show the response body. (empty for success)
print(resp.body_str)
-- Examine the response status code. (204 = success)
print("response status code: " .. resp.status_code)