openapi: 3.1.0
info:
title: Asana Allocations Sections API
description: The Asana Allocations API allows users to manage and allocate resources within their Asana project management system. An allocation object represents how much of a resource (e.g. person, team) is dedicated to a specific work object (e.g. project, portfolio) over a specific period of time. The effort value can be a percentage or number of hours.
version: '1.0'
termsOfService: https://asana.com/terms
contact:
name: Asana Support
url: https://asana.com/support
license:
name: Apache 2.0
url: https://www.apache.org/licenses/LICENSE-2.0
servers:
- url: https://app.asana.com/api/1.0
description: Main endpoint.
security:
- personalAccessToken: []
- oauth2: []
tags:
- name: Sections
description: 'A section is a subdivision of a project that groups tasks together. It can either be a header above a list of tasks in a list view or a column in a board view of a project.
Sections are largely a shared idiom in Asana’s API for both list and board views of a project regardless of the project’s layout.
The ‘memberships’ property when [getting a task](/reference/gettask) will return the information for the section or the column under ‘section’ in the response.'
paths:
/sections/{section_gid}:
parameters:
- $ref: '#/components/parameters/section_path_gid'
- $ref: '#/components/parameters/pretty'
get:
summary: Asana Get a section
description: Returns the complete record for a single section.
tags:
- Sections
operationId: getSection
parameters:
- name: opt_fields
in: query
description: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
required: false
example:
- created_at
- name
- project
- project.name
- projects
- projects.name
schema:
type: array
items:
type: string
enum:
- created_at
- name
- project
- project.name
- projects
- projects.name
style: form
explode: false
responses:
200:
description: Successfully retrieved section.
content:
application/json:
schema:
type: object
properties:
data:
$ref: '#/components/schemas/SectionResponse'
400:
$ref: '#/components/responses/BadRequest'
401:
$ref: '#/components/responses/Unauthorized'
403:
$ref: '#/components/responses/Forbidden'
404:
$ref: '#/components/responses/NotFound'
500:
$ref: '#/components/responses/InternalServerError'
x-readme:
code-samples:
- language: java
install: <dependency><groupId>com.asana</groupId><artifactId>asana</artifactId><version>1.0.0</version></dependency>
code: "import com.asana.Client;\n\nClient client = Client.accessToken(\"PERSONAL_ACCESS_TOKEN\");\n\nSection result = client.sections.getSection(sectionGid)\n .option(\"pretty\", true)\n .execute();"
- language: node
install: npm install asana
code: "const Asana = require('asana');\n\nlet client = Asana.ApiClient.instance;\nlet token = client.authentications['token'];\ntoken.accessToken = '<YOUR_ACCESS_TOKEN>';\n\nlet sectionsApiInstance = new Asana.SectionsApi();\nlet section_gid = \"321654\"; // String | The globally unique identifier for the section.\nlet opts = { \n 'opt_fields': \"created_at,name,project,project.name,projects,projects.name\"\n};\nsectionsApiInstance.getSection(section_gid, opts).then((result) => {\n console.log('API called successfully. Returned data: ' + JSON.stringify(result.data, null, 2));\n}, (error) => {\n console.error(error.response.body);\n});"
name: node-sdk-v3
- language: node
install: npm install asana@1.0.5
code: "const asana = require('asana');\n\nconst client = asana.Client.create().useAccessToken('PERSONAL_ACCESS_TOKEN');\n\nclient.sections.getSection(sectionGid, {param: \"value\", param: \"value\", opt_pretty: true})\n .then((result) => {\n console.log(result);\n });"
name: node-sdk-v1
- language: python
install: pip install asana
code: "import asana\nfrom asana.rest import ApiException\nfrom pprint import pprint\n\nconfiguration = asana.Configuration()\nconfiguration.access_token = '<YOUR_ACCESS_TOKEN>'\napi_client = asana.ApiClient(configuration)\n\n# create an instance of the API class\nsections_api_instance = asana.SectionsApi(api_client)\nsection_gid = \"321654\" # str | The globally unique identifier for the section.\nopts = {\n 'opt_fields': \"created_at,name,project,project.name,projects,projects.name\", # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.\n}\n\ntry:\n # Get a section\n api_response = sections_api_instance.get_section(section_gid, opts)\n pprint(api_response)\nexcept ApiException as e:\n print(\"Exception when calling SectionsApi->get_section: %s\\n\" % e)"
name: python-sdk-v5
- language: python
install: pip install asana==3.2.3
code: 'import asana
client = asana.Client.access_token(''PERSONAL_ACCESS_TOKEN'')
result = client.sections.get_section(section_gid, {''param'': ''value'', ''param'': ''value''}, opt_pretty=True)'
name: python-sdk-v3
- language: php
install: composer require asana/asana
code: '<?php
require ''vendor/autoload.php'';
$client = Asana\Client::accessToken(''PERSONAL_ACCESS_TOKEN'');
$result = $client->sections->getSection($section_gid, array(''param'' => ''value'', ''param'' => ''value''), array(''opt_pretty'' => ''true''))'
- language: ruby
install: gem install asana
code: "require 'asana'\n\nclient = Asana::Client.new do |c|\n c.authentication :access_token, 'PERSONAL_ACCESS_TOKEN'\nend\n\nresult = client.sections.get_section(section_gid: 'section_gid', param: \"value\", param: \"value\", options: {pretty: true})"
put:
summary: Asana Update a section
description: 'A specific, existing section can be updated by making a PUT request on
the URL for that project. Only the fields provided in the `data` block
will be updated; any unspecified fields will remain unchanged. (note that
at this time, the only field that can be updated is the `name` field.)
When using this method, it is best to specify only those fields you wish
to change, or else you may overwrite changes made by another user since
you last retrieved the task.
Returns the complete updated section record.'
tags:
- Sections
operationId: updateSection
parameters:
- name: opt_fields
in: query
description: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
required: false
example:
- created_at
- name
- project
- project.name
- projects
- projects.name
schema:
type: array
items:
type: string
enum:
- created_at
- name
- project
- project.name
- projects
- projects.name
style: form
explode: false
requestBody:
description: The section to create.
content:
application/json:
schema:
type: object
properties:
data:
$ref: '#/components/schemas/SectionRequest'
responses:
200:
description: Successfully updated the specified section.
content:
application/json:
schema:
type: object
properties:
data:
$ref: '#/components/schemas/SectionResponse'
400:
$ref: '#/components/responses/BadRequest'
401:
$ref: '#/components/responses/Unauthorized'
403:
$ref: '#/components/responses/Forbidden'
404:
$ref: '#/components/responses/NotFound'
500:
$ref: '#/components/responses/InternalServerError'
x-readme:
code-samples:
- language: java
install: <dependency><groupId>com.asana</groupId><artifactId>asana</artifactId><version>1.0.0</version></dependency>
code: "import com.asana.Client;\n\nClient client = Client.accessToken(\"PERSONAL_ACCESS_TOKEN\");\n\nSection result = client.sections.updateSection(sectionGid)\n .data(\"field\", \"value\")\n .data(\"field\", \"value\")\n .option(\"pretty\", true)\n .execute();"
- language: node
install: npm install asana
code: "const Asana = require('asana');\n\nlet client = Asana.ApiClient.instance;\nlet token = client.authentications['token'];\ntoken.accessToken = '<YOUR_ACCESS_TOKEN>';\n\nlet sectionsApiInstance = new Asana.SectionsApi();\nlet section_gid = \"321654\"; // String | The globally unique identifier for the section.\nlet opts = { \n 'body': {\"data\": {\"<PARAM_1>\": \"<VALUE_1>\", \"<PARAM_2>\": \"<VALUE_2>\",}}, \n 'opt_fields': \"created_at,name,project,project.name,projects,projects.name\"\n};\nsectionsApiInstance.updateSection(section_gid, opts).then((result) => {\n console.log('API called successfully. Returned data: ' + JSON.stringify(result.data, null, 2));\n}, (error) => {\n console.error(error.response.body);\n});"
name: node-sdk-v3
- language: node
install: npm install asana@1.0.5
code: "const asana = require('asana');\n\nconst client = asana.Client.create().useAccessToken('PERSONAL_ACCESS_TOKEN');\n\nclient.sections.updateSection(sectionGid, {field: \"value\", field: \"value\", pretty: true})\n .then((result) => {\n console.log(result);\n });"
name: node-sdk-v1
- language: python
install: pip install asana
code: "import asana\nfrom asana.rest import ApiException\nfrom pprint import pprint\n\nconfiguration = asana.Configuration()\nconfiguration.access_token = '<YOUR_ACCESS_TOKEN>'\napi_client = asana.ApiClient(configuration)\n\n# create an instance of the API class\nsections_api_instance = asana.SectionsApi(api_client)\nsection_gid = \"321654\" # str | The globally unique identifier for the section.\nopts = {\n 'body': {\"data\": {\"<PARAM_1>\": \"<VALUE_1>\", \"<PARAM_2>\": \"<VALUE_2>\",}}, # dict | The section to create.\n 'opt_fields': \"created_at,name,project,project.name,projects,projects.name\", # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.\n}\n\ntry:\n # Update a section\n api_response = sections_api_instance.update_section(section_gid, opts)\n pprint(api_response)\nexcept ApiException as e:\n print(\"Exception when calling SectionsApi->update_section: %s\\n\" % e)"
name: python-sdk-v5
- language: python
install: pip install asana==3.2.3
code: 'import asana
client = asana.Client.access_token(''PERSONAL_ACCESS_TOKEN'')
result = client.sections.update_section(section_gid, {''field'': ''value'', ''field'': ''value''}, opt_pretty=True)'
name: python-sdk-v3
- language: php
install: composer require asana/asana
code: '<?php
require ''vendor/autoload.php'';
$client = Asana\Client::accessToken(''PERSONAL_ACCESS_TOKEN'');
$result = $client->sections->updateSection($section_gid, array(''field'' => ''value'', ''field'' => ''value''), array(''opt_pretty'' => ''true''))'
- language: ruby
install: gem install asana
code: "require 'asana'\n\nclient = Asana::Client.new do |c|\n c.authentication :access_token, 'PERSONAL_ACCESS_TOKEN'\nend\n\nresult = client.sections.update_section(section_gid: 'section_gid', field: \"value\", field: \"value\", options: {pretty: true})"
delete:
summary: Asana Delete a section
description: 'A specific, existing section can be deleted by making a DELETE request on
the URL for that section.
Note that sections must be empty to be deleted.
The last remaining section cannot be deleted.
Returns an empty data block.'
tags:
- Sections
operationId: deleteSection
responses:
200:
description: Successfully deleted the specified section.
content:
application/json:
schema:
type: object
properties:
data:
$ref: '#/components/schemas/EmptyResponse'
400:
$ref: '#/components/responses/BadRequest'
401:
$ref: '#/components/responses/Unauthorized'
403:
$ref: '#/components/responses/Forbidden'
404:
$ref: '#/components/responses/NotFound'
500:
$ref: '#/components/responses/InternalServerError'
x-readme:
code-samples:
- language: java
install: <dependency><groupId>com.asana</groupId><artifactId>asana</artifactId><version>1.0.0</version></dependency>
code: "import com.asana.Client;\n\nClient client = Client.accessToken(\"PERSONAL_ACCESS_TOKEN\");\n\nJsonElement result = client.sections.deleteSection(sectionGid)\n .option(\"pretty\", true)\n .execute();"
- language: node
install: npm install asana
code: "const Asana = require('asana');\n\nlet client = Asana.ApiClient.instance;\nlet token = client.authentications['token'];\ntoken.accessToken = '<YOUR_ACCESS_TOKEN>';\n\nlet sectionsApiInstance = new Asana.SectionsApi();\nlet section_gid = \"321654\"; // String | The globally unique identifier for the section.\n\nsectionsApiInstance.deleteSection(section_gid).then((result) => {\n console.log('API called successfully. Returned data: ' + JSON.stringify(result.data, null, 2));\n}, (error) => {\n console.error(error.response.body);\n});"
name: node-sdk-v3
- language: node
install: npm install asana@1.0.5
code: "const asana = require('asana');\n\nconst client = asana.Client.create().useAccessToken('PERSONAL_ACCESS_TOKEN');\n\nclient.sections.deleteSection(sectionGid)\n .then((result) => {\n console.log(result);\n });"
name: node-sdk-v1
- language: python
install: pip install asana
code: "import asana\nfrom asana.rest import ApiException\nfrom pprint import pprint\n\nconfiguration = asana.Configuration()\nconfiguration.access_token = '<YOUR_ACCESS_TOKEN>'\napi_client = asana.ApiClient(configuration)\n\n# create an instance of the API class\nsections_api_instance = asana.SectionsApi(api_client)\nsection_gid = \"321654\" # str | The globally unique identifier for the section.\n\n\ntry:\n # Delete a section\n api_response = sections_api_instance.delete_section(section_gid)\n pprint(api_response)\nexcept ApiException as e:\n print(\"Exception when calling SectionsApi->delete_section: %s\\n\" % e)"
name: python-sdk-v5
- language: python
install: pip install asana==3.2.3
code: 'import asana
client = asana.Client.access_token(''PERSONAL_ACCESS_TOKEN'')
result = client.sections.delete_section(section_gid, opt_pretty=True)'
name: python-sdk-v3
- language: php
install: composer require asana/asana
code: '<?php
require ''vendor/autoload.php'';
$client = Asana\Client::accessToken(''PERSONAL_ACCESS_TOKEN'');
$result = $client->sections->deleteSection($section_gid, array(''opt_pretty'' => ''true''))'
- language: ruby
install: gem install asana
code: "require 'asana'\n\nclient = Asana::Client.new do |c|\n c.authentication :access_token, 'PERSONAL_ACCESS_TOKEN'\nend\n\nresult = client.sections.delete_section(section_gid: 'section_gid', options: {pretty: true})"
/projects/{project_gid}/sections:
parameters:
- $ref: '#/components/parameters/project_path_gid'
- $ref: '#/components/parameters/pretty'
get:
summary: Asana Get sections in a project
description: Returns the compact records for all sections in the specified project.
tags:
- Sections
operationId: getSectionsForProject
parameters:
- $ref: '#/components/parameters/limit'
- $ref: '#/components/parameters/offset'
- name: opt_fields
in: query
description: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
required: false
example:
- created_at
- name
- offset
- path
- project
- project.name
- projects
- projects.name
- uri
schema:
type: array
items:
type: string
enum:
- created_at
- name
- offset
- path
- project
- project.name
- projects
- projects.name
- uri
style: form
explode: false
responses:
200:
description: Successfully retrieved sections in project.
content:
application/json:
schema:
type: object
properties:
data:
type: array
items:
$ref: '#/components/schemas/SectionCompact'
next_page:
$ref: '#/components/schemas/NextPage'
400:
$ref: '#/components/responses/BadRequest'
401:
$ref: '#/components/responses/Unauthorized'
403:
$ref: '#/components/responses/Forbidden'
404:
$ref: '#/components/responses/NotFound'
500:
$ref: '#/components/responses/InternalServerError'
x-readme:
code-samples:
- language: java
install: <dependency><groupId>com.asana</groupId><artifactId>asana</artifactId><version>1.0.0</version></dependency>
code: "import com.asana.Client;\n\nClient client = Client.accessToken(\"PERSONAL_ACCESS_TOKEN\");\n\nList<Section> result = client.sections.getSectionsForProject(projectGid)\n .option(\"pretty\", true)\n .execute();"
- language: node
install: npm install asana
code: "const Asana = require('asana');\n\nlet client = Asana.ApiClient.instance;\nlet token = client.authentications['token'];\ntoken.accessToken = '<YOUR_ACCESS_TOKEN>';\n\nlet sectionsApiInstance = new Asana.SectionsApi();\nlet project_gid = \"1331\"; // String | Globally unique identifier for the project.\nlet opts = { \n 'limit': 50, \n 'offset': \"eyJ0eXAiOJiKV1iQLCJhbGciOiJIUzI1NiJ9\", \n 'opt_fields': \"created_at,name,offset,path,project,project.name,projects,projects.name,uri\"\n};\nsectionsApiInstance.getSectionsForProject(project_gid, opts).then((result) => {\n console.log('API called successfully. Returned data: ' + JSON.stringify(result.data, null, 2));\n}, (error) => {\n console.error(error.response.body);\n});"
name: node-sdk-v3
- language: node
install: npm install asana@1.0.5
code: "const asana = require('asana');\n\nconst client = asana.Client.create().useAccessToken('PERSONAL_ACCESS_TOKEN');\n\nclient.sections.getSectionsForProject(projectGid, {param: \"value\", param: \"value\", opt_pretty: true})\n .then((result) => {\n console.log(result);\n });"
name: node-sdk-v1
- language: python
install: pip install asana
code: "import asana\nfrom asana.rest import ApiException\nfrom pprint import pprint\n\nconfiguration = asana.Configuration()\nconfiguration.access_token = '<YOUR_ACCESS_TOKEN>'\napi_client = asana.ApiClient(configuration)\n\n# create an instance of the API class\nsections_api_instance = asana.SectionsApi(api_client)\nproject_gid = \"1331\" # str | Globally unique identifier for the project.\nopts = {\n 'limit': 50, # int | Results per page. The number of objects to return per page. The value must be between 1 and 100.\n 'offset': \"eyJ0eXAiOJiKV1iQLCJhbGciOiJIUzI1NiJ9\", # str | Offset token. An offset to the next page returned by the API. A pagination request will return an offset token, which can be used as an input parameter to the next request. If an offset is not passed in, the API will return the first page of results. *Note: You can only pass in an offset that was returned to you via a previously paginated request.*\n 'opt_fields': \"created_at,name,offset,path,project,project.name,projects,projects.name,uri\", # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.\n}\n\ntry:\n # Get sections in a project\n api_response = sections_api_instance.get_sections_for_project(project_gid, opts)\n for data in api_response:\n pprint(data)\nexcept ApiException as e:\n print(\"Exception when calling SectionsApi->get_sections_for_project: %s\\n\" % e)"
name: python-sdk-v5
- language: python
install: pip install asana==3.2.3
code: 'import asana
client = asana.Client.access_token(''PERSONAL_ACCESS_TOKEN'')
result = client.sections.get_sections_for_project(project_gid, {''param'': ''value'', ''param'': ''value''}, opt_pretty=True)'
name: python-sdk-v3
- language: php
install: composer require asana/asana
code: '<?php
require ''vendor/autoload.php'';
$client = Asana\Client::accessToken(''PERSONAL_ACCESS_TOKEN'');
$result = $client->sections->getSectionsForProject($project_gid, array(''param'' => ''value'', ''param'' => ''value''), array(''opt_pretty'' => ''true''))'
- language: ruby
install: gem install asana
code: "require 'asana'\n\nclient = Asana::Client.new do |c|\n c.authentication :access_token, 'PERSONAL_ACCESS_TOKEN'\nend\n\nresult = client.sections.get_sections_for_project(project_gid: 'project_gid', param: \"value\", param: \"value\", options: {pretty: true})"
post:
summary: Asana Create a section in a project
description: 'Creates a new section in a project.
Returns the full record of the newly created section.'
tags:
- Sections
operationId: createSectionForProject
parameters:
- name: opt_fields
in: query
description: This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.
required: false
example:
- created_at
- name
- project
- project.name
- projects
- projects.name
schema:
type: array
items:
type: string
enum:
- created_at
- name
- project
- project.name
- projects
- projects.name
style: form
explode: false
requestBody:
description: The section to create.
content:
application/json:
schema:
type: object
properties:
data:
$ref: '#/components/schemas/SectionRequest'
responses:
201:
description: Successfully created the specified section.
content:
application/json:
schema:
type: object
properties:
data:
$ref: '#/components/schemas/SectionResponse'
400:
$ref: '#/components/responses/BadRequest'
401:
$ref: '#/components/responses/Unauthorized'
403:
$ref: '#/components/responses/Forbidden'
404:
$ref: '#/components/responses/NotFound'
500:
$ref: '#/components/responses/InternalServerError'
x-readme:
code-samples:
- language: java
install: <dependency><groupId>com.asana</groupId><artifactId>asana</artifactId><version>1.0.0</version></dependency>
code: "import com.asana.Client;\n\nClient client = Client.accessToken(\"PERSONAL_ACCESS_TOKEN\");\n\nSection result = client.sections.createSectionForProject(projectGid)\n .data(\"field\", \"value\")\n .data(\"field\", \"value\")\n .option(\"pretty\", true)\n .execute();"
- language: node
install: npm install asana
code: "const Asana = require('asana');\n\nlet client = Asana.ApiClient.instance;\nlet token = client.authentications['token'];\ntoken.accessToken = '<YOUR_ACCESS_TOKEN>';\n\nlet sectionsApiInstance = new Asana.SectionsApi();\nlet project_gid = \"1331\"; // String | Globally unique identifier for the project.\nlet opts = { \n 'body': {\"data\": {\"<PARAM_1>\": \"<VALUE_1>\", \"<PARAM_2>\": \"<VALUE_2>\",}}, \n 'opt_fields': \"created_at,name,project,project.name,projects,projects.name\"\n};\nsectionsApiInstance.createSectionForProject(project_gid, opts).then((result) => {\n console.log('API called successfully. Returned data: ' + JSON.stringify(result.data, null, 2));\n}, (error) => {\n console.error(error.response.body);\n});"
name: node-sdk-v3
- language: node
install: npm install asana@1.0.5
code: "const asana = require('asana');\n\nconst client = asana.Client.create().useAccessToken('PERSONAL_ACCESS_TOKEN');\n\nclient.sections.createSectionForProject(projectGid, {field: \"value\", field: \"value\", pretty: true})\n .then((result) => {\n console.log(result);\n });"
name: node-sdk-v1
- language: python
install: pip install asana
code: "import asana\nfrom asana.rest import ApiException\nfrom pprint import pprint\n\nconfiguration = asana.Configuration()\nconfiguration.access_token = '<YOUR_ACCESS_TOKEN>'\napi_client = asana.ApiClient(configuration)\n\n# create an instance of the API class\nsections_api_instance = asana.SectionsApi(api_client)\nproject_gid = \"1331\" # str | Globally unique identifier for the project.\nopts = {\n 'body': {\"data\": {\"<PARAM_1>\": \"<VALUE_1>\", \"<PARAM_2>\": \"<VALUE_2>\",}}, # dict | The section to create.\n 'opt_fields': \"created_at,name,project,project.name,projects,projects.name\", # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include.\n}\n\ntry:\n # Create a section in a project\n api_response = sections_api_instance.create_section_for_project(project_gid, opts)\n pprint(api_response)\nexcept ApiException as e:\n print(\"Exception when calling SectionsApi->create_section_for_project: %s\\n\" % e)"
name: python-sdk-v5
- language: python
install: pip install asana==3.2.3
code: 'import asana
client = asana.Client.access_token(''PERSONAL_ACCESS_TOKEN'')
result = client.sections.create_section_for_project(project_gid, {''field'': ''value'', ''field'': ''value''}, opt_pretty=True)'
name: python-sdk-v3
- language: php
install: composer require asana/asana
code: '<?php
require ''vendor/autoload.php'';
$client = Asana\Client::accessToken(''PERSONAL_ACCESS_TOKEN'');
$result = $client->sections->createSectionForProject($project_gid, array(''field'' => ''value'', ''field'' => ''value''), array(''opt_pretty'' => ''true''))'
- language: ruby
install: gem install asana
code: "require 'asana'\n\nclient = Asana::Client.new do |c|\n c.authentication :access_token, 'PERSONAL_ACCESS_TOKEN'\nend\n\nresult = client.sections.create_section_for_project(project_gid: 'project_gid', field: \"value\", field: \"value\", options: {pretty: true})"
/sections/{section_gid}/addTask:
parameters:
- $ref: '#/components/parameters/section_path_gid'
- $ref: '#/components/parameters/pretty'
post:
summary: Asana Add task to section
description: 'Add a task to a specific, existing section. This will remove the task from other sections of the project.
The task will be inserted at the top of a section unless an insert_before or insert_after parameter is declared.
This does not work for separators (tasks with the resource_subtype of section).'
tags:
- Sections
operationId: addTaskForSection
requestBody:
description: The task and optionally the insert location.
content:
application/json:
schema:
type: object
properties:
data:
$ref: '#/components/schemas/SectionTaskInsertRequest'
responses:
200:
description: Successfully added the task.
content:
application/json:
schema:
type: object
properties:
data:
$ref: '#/components/schemas/EmptyResponse'
400:
$ref: '#/components/responses/BadRequest'
401:
$ref: '#/components/responses/Unauthorized'
403:
$ref: '#/components/responses/Forbidden'
404:
$ref: '#/components/responses/NotFound'
500:
$ref: '#/components/responses/InternalServerError'
security:
- oauth2:
- tasks:write
x-readme:
code-samples:
- language: java
install: <dependency><groupId>com.asana</groupId><artifactId>asana</artifactId><version>1.0.0</version></dependency>
code: "import com.asana.Client;\n\nClient client = Client.accessToken(\"PERSONAL_ACCESS_TOKEN\");\n\nJsonElement result = client.sections.addTaskForSection(sectionGid)\n .data(\"field\", \"value\")\n .data(\"field\", \"value\")\n .option(\"pretty\", true)\n .execute();"
- language: node
install: npm install asana
code: "const Asana = require('asana');\n\nlet client = Asana.ApiClient.instance;\nlet token = client.authentications['token'];\ntoken.accessToken = '<YOUR_ACCESS_TOKEN>';\n\nlet sectionsApiInstance = new Asana.SectionsApi();\nlet section_gid = \"321654\"; // String | The globally unique identifier for the section.\nlet opts = { \n 'body': {\"data\": {\"<PARAM_1>\": \"<VALUE_1>\", \"<PARAM_2>\": \"<VALUE_2>\",}}\n};\nsectionsApiInstance.addTaskForSection(section_gid, opts).then((result) => {\n console.log('API called successfully. Returned data: ' + JSON.stringify(result.data, null, 2));\n}, (error) => {\n console.error(error.response.body);\n});"
name: node-sdk-v3
- language: node
install: npm install asana@1.0.5
code: "const asana = require('asana');\n\nconst client = asana.Client.create().useAccessToken('PERSONAL_ACCESS_TOKEN');\n\nclient.sections.addTaskForSection(sectionGid, {field: \"value\", field: \"value\", pretty: true})\n .then((result) => {\n console.log(result);\n });"
name: node-sdk-v1
- language: python
install: p
# --- truncated at 32 KB (50 KB total) ---
# Full source: https://raw.githubusercontent.com/api-evangelist/asana/refs/heads/main/openapi/asana-sections-api-openapi.yml