Google Tasks API

Tasklists: insert

Requires authorization

Creates a new task list and adds it to the authenticated user's task lists. Try it now or see an example.

Request

HTTP Request

POST https://www.googleapis.com/tasks/v1/users/@me/lists

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 Tasklists resource.

Response

If successful, this method returns a Tasklists 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

TaskList taskList = new TaskList();
taskList.setTitle("New Task List");

TaskList result = service.tasklists.insert(taskList).execute();
System.out.println(result.getId());

PHP

Uses the PHP client library

$tasklist = new TaskList();
$tasklist->setTitle('New Task List');

$result = $service->insertTasklists($tasklist);
echo $result->getTitle();

Python

Uses the Python client library

tasklist = {
  'title': 'New Task List'
  }

result = service.tasklists().insert(body=tasklist).execute()
print result['id']

.NET

Uses the .NET client library

TaskList list = new TaskList { Title = "New Task List" };
list = service.Tasklists.Insert(list).Fetch();
Console.WriteLine(list.Id);

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.