Lua
Lua
Delete a Task from a Task List
See more Google Tasks Examples
Demonstrates how to delete a Google task from a 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
http:set_url_var("tasklist", "MDM4MzQ4NTA3NDQwMDUxMzQ2OTQ6NzAwOTA4MDA1NzU2ODYwMzow")
http:set_url_var("task", "MDM4MzQ4NTA3NDQwMDUxMzQ2OTQ6NzAwOTA4MDA1NzU2ODYwMzoxMTg0MzQxMTkzMjM2MDY1")
local resp = chilkat.HttpResponse.new()
local success = http:http_no_body("DELETE", "https://www.googleapis.com/tasks/v1/lists/{$tasklist}/tasks/{$task}", 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)