Google Tasks API

Tasks: update

Requires authorization

Updates the specified task. Try it now or see an example.

Request

HTTP Request

PUT https://www.googleapis.com/tasks/v1/lists/tasklist/tasks/task

Parameters

Parameter Name Value Description
Required Parameters
task string Task identifier.
tasklist string Task list identifier.

Authorization

This request requires authorization with at least one of the following scopes (read more about authentication and authorization).

Scope
https://www.googleapis.com/auth/tasks

Request Body

In the request body, supply a Tasks resource.

Response

If successful, this method returns a Tasks resource in the response body.

Examples

Note: The code examples available for this method do not represent all supported programming languages (see the client libraries page for a list of supported languages).

Java

Uses the Java client library

// First retrieve the task to update.
Task task = service.tasks.get("@default", "taskID").execute();
task.setStatus("completed");

Task result = service.tasks.update("@default", task.getId(), task).execute();
// Print the completed date.
System.out.println(result.getCompleted());

PHP

Uses the PHP client library

/*
 * First retrieve the task to update.
 */
$task = $service->getTasks('@default', 'taskID');
$task->setStatus('completed');

$result = $service->updateTasks($task->getId(), '@default', $task);
/*
 * Print the completed date.
 */
echo $result->getCompleted();

Python

Uses the Python client library

# First retrieve the task to update.
task = service.tasks().get(tasklist='@default', task='taskID').execute()
task['status'] = 'completed'

result = service.tasks().update(tasklist='@default', task=task['id'], body=task).execute()
# Print the completed date.
print result['completed']

.NET

Uses the .NET client library

// First retrieve the task to update.
Task task = service.Tasks.Get("@default", "taskID").Fetch();
task.Status = "completed";

Task result = service.Tasks.Update(task, "@default", task.Id).Fetch();
// Print the completed date.
Console.WriteLine(XmlConvert.ToDateTime(result.Completed, XmlDateTimeSerializationMode.Utc));

Try It!

Use the explorer below to call this method on live data and see the response. Alternatively, try the standalone explorer.

Authentication required

You need to be signed in with Google+ to do that.

Signing you in...

Google Developers needs your permission to do that.