### Browser Example: Get User Data Source: https://github.com/asana/node-asana/blob/master/README.md Example of how to initialize the Asana client and fetch user data in a browser environment. Ensure your access token is kept secure and not exposed publicly. ```html ``` -------------------------------- ### Node.js Example: Get User Data with Options Source: https://github.com/asana/node-asana/blob/master/README.md Initialize the Asana client in Node.js and fetch user data, including specific fields like email, name, and workspace details. This example demonstrates how to use `opt_fields` to customize the response. ```javascript const Asana = require('asana'); let client = new Asana.ApiClient(); client.authentications.token.accessToken = ''; let usersApiInstance = new Asana.UsersApi(client); let user_gid = "me"; // String | A string identifying a user. This can either be the string "me", an email, or the gid of a user. let opts = { "opt_fields": "email,name,photo,photo.image_1024x1024,photo.image_128x128,photo.image_21x21,photo.image_27x27,photo.image_36x36,photo.image_60x60,workspaces,workspaces.name" // [String] | 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. }; usersApiInstance.getUser(user_gid, opts).then((result) => { console.log('API called successfully. Returned data: ' + JSON.stringify(result.data, null, 2)); }, (error) => { console.error(error.response.body); }); ``` -------------------------------- ### Get Projects with Options Source: https://github.com/asana/node-asana/blob/master/docs/ProjectsApi.md Retrieve a list of projects from Asana. This example demonstrates how to authenticate the client and specify various options for filtering, pagination, and selecting specific fields. ```javascript const Asana = require('asana'); let client = new Asana.ApiClient(); client.authentications.token.accessToken = ''; let projectsApiInstance = new Asana.ProjectsApi(client); let opts = { 'limit': 50, 'offset': "eyJ0eXAiOJiKV1iQLCJhbGciOiJIUzI1NiJ9", 'workspace': "1331", 'team': "14916", 'archived': false, 'opt_fields': "archived,color,completed,completed_at,completed_by,completed_by.name,created_at,created_from_template,created_from_template.name,current_status,current_status.author,current_status.author.name,current_status.color,current_status.created_at,current_status.created_by,current_status.created_by.name,current_status.html_text,current_status.modified_at,current_status.text,current_status.title,current_status_update,current_status_update.resource_subtype,current_status_update.title,custom_field_settings,custom_field_settings.custom_field,custom_field_settings.custom_field.asana_created_field,custom_field_settings.custom_field.created_by,custom_field_settings.custom_field.created_by.name,custom_field_settings.custom_field.currency_code,custom_field_settings.custom_field.custom_label,custom_field_settings.custom_field.custom_label_position,custom_field_settings.custom_field.date_value,custom_field_settings.custom_field.date_value.date,custom_field_settings.custom_field.date_value.date_time,custom_field_settings.custom_field.default_access_level,custom_field_settings.custom_field.description,custom_field_settings.custom_field.display_value,custom_field_settings.custom_field.enabled,custom_field_settings.custom_field.enum_options,custom_field_settings.custom_field.enum_options.color,custom_field_settings.custom_field.enum_options.enabled,custom_field_settings.custom_field.enum_options.name,custom_field_settings.custom_field.enum_value,custom_field_settings.custom_field.enum_value.color,custom_field_settings.custom_field.enum_value.enabled,custom_field_settings.custom_field.enum_value.name,custom_field_settings.custom_field.format,custom_field_settings.custom_field.has_notifications_enabled,custom_field_settings.custom_field.html_text_value,custom_field_settings.custom_field.id_prefix,custom_field_settings.custom_field.input_restrictions,custom_field_settings.custom_field.is_formula_field,custom_field_settings.custom_field.is_global_to_workspace,custom_field_settings.custom_field.is_value_read_only,custom_field_settings.custom_field.multi_enum_values,custom_field_settings.custom_field.multi_enum_values.color,custom_field_settings.custom_field.multi_enum_values.enabled,custom_field_settings.custom_field.multi_enum_values.name,custom_field_settings.custom_field.name,custom_field_settings.custom_field.number_value,custom_field_settings.custom_field.people_value,custom_field_settings.custom_field.people_value.name,custom_field_settings.custom_field.precision,custom_field_settings.custom_field.privacy_setting,custom_field_settings.custom_field.reference_value,custom_field_settings.custom_field.reference_value.name,custom_field_settings.custom_field.representation_type,custom_field_settings.custom_field.resource_subtype,custom_field_settings.custom_field.text_value,custom_field_settings.custom_field.type,custom_field_settings.is_important,custom_field_settings.parent,custom_field_settings.parent.name,custom_field_settings.project,custom_field_settings.project.name,custom_fields,custom_fields.date_value,custom_fields.date_value.date,custom_fields.date_value.date_time,custom_fields.display_value,custom_fields.enabled,custom_fields.enum_options,custom_fields.enum_options.color,custom_fields.enum_options.enabled,custom_fields.enum_options.name,custom_fields.enum_value,custom_fields.enum_value.color,custom_fields.enum_value.enabled,custom_fields.enum_value.name,custom_fields.id_prefix,custom_fields.input_restrictions,custom_fields.is_formula_field,custom_fields.multi_enum_values,custom_fields.multi_enum_values.color,custom_fields.multi_enum_values.enabled,custom_fields.multi_enum_values.name,custom_fields.name,custom_fields.number_value,custom_fields.representation_type,custom_fields.text_value,custom_fields.type,default_access_level,default_view,due_date,due_on,followers,followers.name,html_notes,icon,members,members.name,minimum_access_level_for_customization,minimum_access_level_for_sharing,modified_at,name,notes,offset,owner,path,permalink_url,privacy_setting,project_brief,public,start_on,team,team.name,uri,workspace,workspace.name" }; projectsApiInstance.getProjects(opts).then((result) => { console.log('API called successfully. Returned data: ' + JSON.stringify(result.data, null, 2)); }, (error) => { console.error(error.response.body); }); ``` -------------------------------- ### Get Goals with Options Source: https://github.com/asana/node-asana/blob/master/docs/GoalsApi.md Retrieves goals from Asana using the GoalsApi. This example demonstrates how to set various options for filtering and field selection. Ensure you replace '' with your actual Asana access token. ```javascript const Asana = require('asana'); let client = new Asana.ApiClient(); client.authentications.token.accessToken = ''; let goalsApiInstance = new Asana.GoalsApi(client); let opts = { 'portfolio': "159874", 'project': "512241", 'task': "78424", 'is_workspace_level': false, 'team': "31326", 'workspace': "31326", 'time_periods': "221693,506165", 'limit': 50, 'offset': "eyJ0eXAiOJiKV1iQLCJhbGciOiJIUzI1NiJ9", 'opt_fields': "current_status_update,current_status_update.resource_subtype,current_status_update.title,custom_field_settings,custom_field_settings.custom_field,custom_field_settings.custom_field.asana_created_field,custom_field_settings.custom_field.created_by,custom_field_settings.custom_field.created_by.name,custom_field_settings.custom_field.currency_code,custom_field_settings.custom_field.custom_label,custom_field_settings.custom_field.custom_label_position,custom_field_settings.custom_field.date_value,custom_field_settings.custom_field.date_value.date,custom_field_settings.custom_field.date_value.date_time,custom_field_settings.custom_field.default_access_level,custom_field_settings.custom_field.description,custom_field_settings.custom_field.display_value,custom_field_settings.custom_field.enabled,custom_field_settings.custom_field.enum_options,custom_field_settings.custom_field.enum_options.color,custom_field_settings.custom_field.enum_options.enabled,custom_field_settings.custom_field.enum_options.name,custom_field_settings.custom_field.enum_value,custom_field_settings.custom_field.enum_value.color,custom_field_settings.custom_field.enum_value.enabled,custom_field_settings.custom_field.enum_value.name,custom_field_settings.custom_field.format,custom_field_settings.custom_field.has_notifications_enabled,custom_field_settings.custom_field.html_text_value,custom_field_settings.custom_field.id_prefix,custom_field_settings.custom_field.input_restrictions,custom_field_settings.custom_field.is_formula_field,custom_field_settings.custom_field.is_global_to_workspace,custom_field_settings.custom_field.is_value_read_only,custom_field_settings.custom_field.multi_enum_values,custom_field_settings.custom_field.multi_enum_values.color,custom_field_settings.custom_field.multi_enum_values.enabled,custom_field_settings.custom_field.multi_enum_values.name,custom_field_settings.custom_field.name,custom_field_settings.custom_field.number_value,custom_field_settings.custom_field.people_value,custom_field_settings.custom_field.people_value.name,custom_field_settings.custom_field.precision,custom_field_settings.custom_field.privacy_setting,custom_field_settings.custom_field.reference_value,custom_field_settings.custom_field.reference_value.name,custom_field_settings.custom_field.representation_type,custom_field_settings.custom_field.resource_subtype,custom_field_settings.custom_field.text_value,custom_field_settings.custom_field.type,custom_field_settings.is_important,custom_field_settings.parent,custom_field_settings.parent.name,custom_field_settings.project,custom_field_settings.project.name,custom_fields,custom_fields.date_value,custom_fields.date_value.date,custom_fields.date_value.date_time,custom_fields.display_value,custom_fields.enabled,custom_fields.enum_options,custom_fields.enum_options.color,custom_fields.enum_options.enabled,custom_fields.enum_options.name,custom_fields.enum_value,custom_fields.enum_value.color,custom_fields.enum_value.enabled,custom_fields.enum_value.name,custom_fields.id_prefix,custom_fields.input_restrictions,custom_fields.is_formula_field,custom_fields.multi_enum_values,custom_fields.multi_enum_values.color,custom_fields.multi_enum_values.enabled,custom_fields.multi_enum_values.name,custom_fields.name,custom_fields.number_value,custom_fields.representation_type,custom_fields.text_value,custom_fields.type,default_access_level,due_on,followers,followers.name,html_notes,is_workspace_level,liked,likes,likes.user,likes.user.name,metric,metric.can_manage,metric.currency_code,metric.current_display_value,metric.current_number_value,metric.initial_number_value,metric.is_custom_weight,metric.precision,metric.progress_source,metric.resource_subtype,metric.target_number_value,metric.unit,name,notes,num_likes,offset,owner,owner.name,path,privacy_setting,start_on,status,team,team.name,time_period,time_period.display_name,time_period.end_on,time_period.period,time_period.start_on,uri,workspace,workspace.name" }; goalsApiInstance.getGoals(opts).then((result) => { console.log('API called successfully. Returned data: ' + JSON.stringify(result.data, null, 2)); }, (error) => { console.error(error.response.body); }); ``` -------------------------------- ### Install Asana Node.js Package Source: https://github.com/asana/node-asana/blob/master/README.md Install the Asana Node.js client library using npm. This command saves the package as a dependency in your project. ```shell npm install asana --save ``` -------------------------------- ### Asana.GoalsApi.getGoals Source: https://github.com/asana/node-asana/blob/master/README.md Get a list of goals. ```APIDOC ## GET /goals ### Description Get a list of goals. ### Method GET ### Endpoint /goals ``` -------------------------------- ### Environment Variables Setup Source: https://github.com/asana/node-asana/blob/master/build-tests/README.md Configure your environment by creating a .env file with the necessary Asana API credentials and identifiers. Ensure custom fields and tasks are set up as specified. ```env PERSONAL_ACCESS_TOKEN= TEAM_GID= TEXT_CUSTOM_FIELD_GID= -> NOTE: make sure that there is at least one task that has this custom field and the value of the custom field on that task is `custom_value` USER_GID= WORKSPACE_GID= ``` -------------------------------- ### Get Multiple Tasks with Filters Source: https://github.com/asana/node-asana/blob/master/docs/TasksApi.md Fetches a collection of tasks with advanced filtering capabilities. This example demonstrates setting various options like limit, assignee, project, and custom fields. For complex queries, consider using the task search API. ```javascript const Asana = require('asana'); let client = new Asana.ApiClient(); client.authentications.token.accessToken = ''; let tasksApiInstance = new Asana.TasksApi(client); let opts = { 'limit': 50, 'offset': "eyJ0eXAiOJiKV1iQLCJhbGciOiJIUzI1NiJ9", 'assignee': "14641", 'project': "321654", 'section': "321654", 'workspace': "321654", 'completed_since': "2012-02-22T02:06:58.158Z", 'modified_since': "2012-02-22T02:06:58.158Z", 'opt_fields': "actual_time_minutes,approval_status,assigned_by,assigned_by.name,assignee,assignee.name,assignee_section,assignee_section.name,assignee_status,completed,completed_at,completed_by,completed_by.name,created_at,created_by,custom_fields,custom_fields.asana_created_field,custom_fields.created_by,custom_fields.created_by.name,custom_fields.currency_code,custom_fields.custom_label,custom_fields.custom_label_position,custom_fields.date_value,custom_fields.date_value.date,custom_fields.date_value.date_time,custom_fields.default_access_level,custom_fields.description,custom_fields.display_value,custom_fields.enabled,custom_fields.enum_options,custom_fields.enum_options.color,custom_fields.enum_options.enabled,custom_fields.enum_options.name,custom_fields.enum_value,custom_fields.enum_value.color,custom_fields.enum_value.enabled,custom_fields.enum_value.name,custom_fields.format,custom_fields.has_notifications_enabled,custom_fields.html_text_value,custom_fields.id_prefix,custom_fields.input_restrictions,custom_fields.is_formula_field,custom_fields.is_global_to_workspace,custom_fields.is_value_read_only,custom_fields.multi_enum_values,custom_fields.multi_enum_values.color,custom_fields.multi_enum_values.enabled,custom_fields.multi_enum_values.name,custom_fields.name,custom_fields.number_value,custom_fields.people_value,custom_fields.people_value.name,custom_fields.precision,custom_fields.privacy_setting,custom_fields.reference_value,custom_fields.reference_value.name,custom_fields.representation_type,custom_fields.resource_subtype,custom_fields.text_value,custom_fields.type,custom_type,custom_type.name,custom_type_status_option,custom_type_status_option.name,dependencies,dependents,due_at,due_on,external,external.data,followers,followers.name,hearted,hearts,hearts.user,hearts.user.name,html_notes,is_rendered_as_separator,liked,likes,likes.user,likes.user.name,memberships,memberships.project,memberships.project.name,memberships.section,memberships.section.name,modified_at,name,notes,num_subtasks,num_hearts,num_likes,offset,parent,parent.created_by,parent.name,parent.resource_subtype,path,permalink_url,projects,projects.name,resource_subtype,start_at,start_on,tags,tags.name,uri,workspace,workspace.name" }; tasksApiInstance.getTasks(opts).then((result) => { console.log('API called successfully. Returned data: ' + JSON.stringify(result.data, null, 2)); }, (error) => { console.error(error.response.body); }); ``` -------------------------------- ### Create Project Brief - JavaScript Source: https://github.com/asana/node-asana/blob/master/docs/ProjectBriefsApi.md Use this snippet to create a new project brief. Ensure you have your access token and the correct project GID. Optional fields can be specified to include additional properties in the response. ```javascript const Asana = require('asana'); let client = new Asana.ApiClient(); client.authentications.token.accessToken = ''; let projectBriefsApiInstance = new Asana.ProjectBriefsApi(client); let body = {"data": {"": "", "": "",}}; let project_gid = "1331"; let opts = { 'opt_fields': "html_text,permalink_url,project,project.name,text,title" }; projectBriefsApiInstance.createProjectBrief(body, project_gid, opts).then((result) => { console.log('API called successfully. Returned data: ' + JSON.stringify(result.data, null, 2)); }, (error) => { console.error(error.response.body); }); ``` -------------------------------- ### GET - Get a task Source: https://github.com/asana/node-asana/blob/master/README.md Retrieves a specific task using its GID. This demonstrates a GET request with path parameters. ```APIDOC ## GET /tasks/{task_gid} ### Description Retrieves a specific task using its unique identifier (GID). ### Method GET ### Endpoint /tasks/{task_gid} ### Parameters #### Path Parameters - **task_gid** (string) - Required - The GID of the task to retrieve. #### Query Parameters None explicitly shown in this example. #### Request Body None ### Request Example ```javascript // Example omitted as it's covered by the main code snippet ``` ### Response #### Success Response (200) - **data** (object) - Contains the task object with its details. #### Response Example ```json { "data": { "gid": "", "name": "Example Task Name", "notes": "Example task notes" // ... other task fields } } ``` ``` -------------------------------- ### GET /webhooks/{webhook_gid} Source: https://github.com/asana/node-asana/blob/master/README.md Get a webhook. ```APIDOC ## GET /webhooks/{webhook_gid} ### Description Get a webhook. ### Method GET ### Endpoint /webhooks/{webhook_gid} ``` -------------------------------- ### Asana.ProjectBriefsApi.createProjectBrief Source: https://github.com/asana/node-asana/blob/master/README.md Creates a project brief for a given project. ```APIDOC ## POST /projects/{project_gid}/project_briefs ### Description Create a project brief. ### Method POST ### Endpoint /projects/{project_gid}/project_briefs ``` -------------------------------- ### Create a Project for a Workspace Source: https://github.com/asana/node-asana/blob/master/docs/ProjectsApi.md Use this snippet to create a new project within a specified workspace. Ensure you have replaced '' with your actual Asana personal access token and provided valid values for '', '', '', and ''. The 'opt_fields' parameter allows for granular control over the returned project data. ```javascript const Asana = require('asana'); let client = new Asana.ApiClient(); client.authentications.token.accessToken = ''; let projectsApiInstance = new Asana.ProjectsApi(client); let body = {"data": {"": "", "": "",}}; // Object | The new project to create. let workspace_gid = "12345"; // String | Globally unique identifier for the workspace or organization. let opts = { 'opt_fields': "archived,color,completed,completed_at,completed_by,completed_by.name,created_at,created_from_template,created_from_template.name,current_status,current_status.author,current_status.author.name,current_status.color,current_status.created_at,current_status.created_by,current_status.created_by.name,current_status.html_text,current_status.modified_at,current_status.text,current_status.title,current_status_update,current_status_update.resource_subtype,current_status_update.title,custom_field_settings,custom_field_settings.custom_field,custom_field_settings.custom_field.asana_created_field,custom_field_settings.custom_field.created_by,custom_field_settings.custom_field.created_by.name,custom_field_settings.custom_field.currency_code,custom_field_settings.custom_field.custom_label,custom_field_settings.custom_field.custom_label_position,custom_field_settings.custom_field.date_value,custom_field_settings.custom_field.date_value.date,custom_field_settings.custom_field.date_value.date_time,custom_field_settings.custom_field.default_access_level,custom_field_settings.custom_field.description,custom_field_settings.custom_field.display_value,custom_field_settings.custom_field.enabled,custom_field_settings.custom_field.enum_options,custom_field_settings.custom_field.enum_options.color,custom_field_settings.custom_field.enum_options.enabled,custom_field_settings.custom_field.enum_options.name,custom_field_settings.custom_field.enum_value,custom_field_settings.custom_field.enum_value.color,custom_field_settings.custom_field.enum_value.enabled,custom_field_settings.custom_field.enum_value.name,custom_field_settings.custom_field.format,custom_field_settings.custom_field.has_notifications_enabled,custom_field_settings.custom_field.html_text_value,custom_field_settings.custom_field.id_prefix,custom_field_settings.custom_field.input_restrictions,custom_field_settings.custom_field.is_formula_field,custom_field_settings.custom_field.is_global_to_workspace,custom_field_settings.custom_field.is_value_read_only,custom_field_settings.custom_field.multi_enum_values,custom_field_settings.custom_field.multi_enum_values.color,custom_field_settings.custom_field.multi_enum_values.enabled,custom_field_settings.custom_field.multi_enum_values.name,custom_field_settings.custom_field.name,custom_field_settings.custom_field.number_value,custom_field_settings.custom_field.people_value,custom_field_settings.custom_field.people_value.name,custom_field_settings.custom_field.precision,custom_field_settings.custom_field.privacy_setting,custom_field_settings.custom_field.reference_value,custom_field_settings.custom_field.reference_value.name,custom_field_settings.custom_field.representation_type,custom_field_settings.custom_field.resource_subtype,custom_field_settings.custom_field.text_value,custom_field_settings.custom_field.type,custom_field_settings.is_important,custom_field_settings.parent,custom_field_settings.parent.name,custom_field_settings.project,custom_field_settings.project.name,custom_fields,custom_fields.date_value,custom_fields.date_value.date,custom_fields.date_value.date_time,custom_fields.display_value,custom_fields.enabled,custom_fields.enum_options,custom_fields.enum_options.color,custom_fields.enum_options.enabled,custom_fields.enum_options.name,custom_fields.enum_value,custom_fields.enum_value.color,custom_fields.enum_value.enabled,custom_fields.enum_value.name,custom_fields.id_prefix,custom_fields.input_restrictions,custom_fields.is_formula_field,custom_fields.multi_enum_values,custom_fields.multi_enum_values.color,custom_fields.multi_enum_values.enabled,custom_fields.multi_enum_values.name,custom_fields.name,custom_fields.number_value,custom_fields.representation_type,custom_fields.text_value,custom_fields.type,default_access_level,default_view,due_date,due_on,followers,followers.name,html_notes,icon,members,members.name,minimum_access_level_for_customization,minimum_access_level_for_sharing,modified_at,name,notes,owner,permalink_url,privacy_setting,project_brief,public,start_on,team,team.name,workspace,workspace.name" }; projectsApiInstance.createProjectForWorkspace(body, workspace_gid, opts).then((result) => { console.log('API called successfully. Returned data: ' + JSON.stringify(result.data, null, 2)); }, (error) => { console.error(error.response.body); }); ``` -------------------------------- ### GET /users Source: https://github.com/asana/node-asana/blob/master/README.md Get multiple users. ```APIDOC ## GET /users ### Description Get multiple users. ### Method GET ### Endpoint /users ``` -------------------------------- ### GET /users/{user_gid} Source: https://github.com/asana/node-asana/blob/master/README.md Get a user. ```APIDOC ## GET /users/{user_gid} ### Description Get a user. ### Method GET ### Endpoint /users/{user_gid} ``` -------------------------------- ### instantiateProject Source: https://github.com/asana/node-asana/blob/master/docs/ProjectTemplatesApi.md Instantiate a project from a project template. ```APIDOC ## POST /project_templates/{project_template_gid}/instantiateProject ### Description Instantiate a project from a project template. ### Method POST ### Endpoint /project_templates/{project_template_gid}/instantiateProject ### Parameters #### Path Parameters - **project_template_gid** (String) - Required - The ID of the project template to instantiate. ### Response #### Success Response (200) - Returns the newly created project. ``` -------------------------------- ### Create a Project Source: https://github.com/asana/node-asana/blob/master/docs/ProjectsApi.md Use this snippet to create a new project in Asana. Ensure you replace '' with your actual token and '', '', etc., with your project's specific details. ```javascript const Asana = require('asana'); let client = new Asana.ApiClient(); client.authentications.token.accessToken = ''; let projectsApiInstance = new Asana.ProjectsApi(client); let body = {"data": {"": "", "": "",}}; // Object | The project to create. let opts = { 'opt_fields': "archived,color,completed,completed_at,completed_by,completed_by.name,created_at,created_from_template,created_from_template.name,current_status,current_status.author,current_status.author.name,current_status.color,current_status.created_at,current_status.created_by,current_status.created_by.name,current_status.html_text,current_status.modified_at,current_status.text,current_status.title,current_status_update,current_status_update.resource_subtype,current_status_update.title,custom_field_settings,custom_field_settings.custom_field,custom_field_settings.custom_field.asana_created_field,custom_field_settings.custom_field.created_by,custom_field_settings.custom_field.created_by.name,custom_field_settings.custom_field.currency_code,custom_field_settings.custom_field.custom_label,custom_field_settings.custom_field.custom_label_position,custom_field_settings.custom_field.date_value,custom_field_settings.custom_field.date_value.date,custom_field_settings.custom_field.date_value.date_time,custom_field_settings.custom_field.default_access_level,custom_field_settings.custom_field.description,custom_field_settings.custom_field.display_value,custom_field_settings.custom_field.enabled,custom_field_settings.custom_field.enum_options,custom_field_settings.custom_field.enum_options.color,custom_field_settings.custom_field.enum_options.enabled,custom_field_settings.custom_field.enum_options.name,custom_field_settings.custom_field.enum_value,custom_field_settings.custom_field.enum_value.color,custom_field_settings.custom_field.enum_value.enabled,custom_field_settings.custom_field.enum_value.name,custom_field_settings.custom_field.format,custom_field_settings.custom_field.has_notifications_enabled,custom_field_settings.custom_field.html_text_value,custom_field_settings.custom_field.id_prefix,custom_field_settings.custom_field.input_restrictions,custom_field_settings.custom_field.is_formula_field,custom_field_settings.custom_field.is_global_to_workspace,custom_field_settings.custom_field.is_value_read_only,custom_field_settings.custom_field.multi_enum_values,custom_field_settings.custom_field.multi_enum_values.color,custom_field_settings.custom_field.multi_enum_values.enabled,custom_field_settings.custom_field.multi_enum_values.name,custom_field_settings.custom_field.name,custom_field_settings.custom_field.number_value,custom_field_settings.custom_field.people_value,custom_field_settings.custom_field.people_value.name,custom_field_settings.custom_field.precision,custom_field_settings.custom_field.privacy_setting,custom_field_settings.custom_field.reference_value,custom_field_settings.custom_field.reference_value.name,custom_field_settings.custom_field.representation_type,custom_field_settings.custom_field.resource_subtype,custom_field_settings.custom_field.text_value,custom_field_settings.custom_field.type,custom_field_settings.is_important,custom_field_settings.parent,custom_field_settings.parent.name,custom_field_settings.project,custom_field_settings.project.name,custom_fields,custom_fields.date_value,custom_fields.date_value.date,custom_fields.date_value.date_time,custom_fields.display_value,custom_fields.enabled,custom_fields.enum_options,custom_fields.enum_options.color,custom_fields.enum_options.enabled,custom_fields.enum_options.name,custom_fields.enum_value,custom_fields.enum_value.color,custom_fields.enum_value.enabled,custom_fields.enum_value.name,custom_fields.id_prefix,custom_fields.input_restrictions,custom_fields.is_formula_field,custom_fields.multi_enum_values,custom_fields.multi_enum_values.color,custom_fields.multi_enum_values.enabled,custom_fields.multi_enum_values.name,custom_fields.name,custom_fields.number_value,custom_fields.representation_type,custom_fields.text_value,custom_fields.type,default_access_level,default_view,due_date,due_on,followers,followers.name,html_notes,icon,members,members.name,minimum_access_level_for_customization,minimum_access_level_for_sharing,modified_at,name,notes,owner,permalink_url,privacy_setting,project_brief,public,start_on,team,team.name,workspace,workspace.name" }; projectsApiInstance.createProject(body, opts).then((result) => { console.log('API called successfully. Returned data: ' + JSON.stringify(result.data, null, 2)); }, (error) => { console.error(error.response.body); }); ``` -------------------------------- ### GET /workspace_memberships/{workspace_membership_gid} Source: https://github.com/asana/node-asana/blob/master/README.md Get a workspace membership. ```APIDOC ## GET /workspace_memberships/{workspace_membership_gid} ### Description Get a workspace membership. ### Method GET ### Endpoint /workspace_memberships/{workspace_membership_gid} ``` -------------------------------- ### Create Webhook using Asana Node.js Client Source: https://github.com/asana/node-asana/blob/master/docs/WebhooksApi.md Example of creating a webhook using the Asana Node.js client library. Ensure you replace placeholders and configure the client with your access token. The `body` parameter should contain the webhook's resource and target. ```javascript const Asana = require('asana'); let client = new Asana.ApiClient(); client.authentications.token.accessToken = ''; let webhooksApiInstance = new Asana.WebhooksApi(client); let body = {"data": {"": "", "": "",}}; // Object | The webhook workspace and target. let opts = { 'opt_fields': "active,created_at,delivery_retry_count,failure_deletion_timestamp,filters,filters.action,filters.fields,filters.resource_subtype,last_failure_at,last_failure_content,last_success_at,next_attempt_after,resource,resource.name,target" }; webhooksApiInstance.createWebhook(body, opts).then((result) => { console.log('API called successfully. Returned data: ' + JSON.stringify(result.data, null, 2)); }, (error) => { console.error(error.response.body); }); ``` -------------------------------- ### get Source: https://github.com/asana/node-asana/wiki/Dispatcher.API Dispatches a GET request to the Asana API. ```APIDOC ## get ### Description Dispatches a GET request to the Asana API. ### Method GET ### Endpoint [path] ### Parameters #### Path Parameters - **path** (String) - Required - The path of the API #### Query Parameters - **query** (Object) - Optional - The query params ### Returns - **BPromise** - The response for the request ``` -------------------------------- ### Instantiate Project from Template Source: https://github.com/asana/node-asana/blob/master/docs/ProjectTemplatesApi.md Use this method to create a new project based on a project template. You'll need the project template's GID and can optionally specify details like the new project's name and team. The body of the request may differ for organizations. ```javascript const Asana = require('asana'); let client = new Asana.ApiClient(); client.authentications.token.accessToken = ''; let projectTemplatesApiInstance = new Asana.ProjectTemplatesApi(client); let project_template_gid = "1331"; // String | Globally unique identifier for the project template. let opts = { 'body': {"data": {"": "", "": "",}}, 'opt_fields': "new_graph_export,new_graph_export.completed_at,new_graph_export.created_at,new_graph_export.download_url,new_portfolio,new_portfolio.name,new_project,new_project.name,new_project_template,new_project_template.name,new_resource_export,new_resource_export.completed_at,new_resource_export.created_at,new_resource_export.download_url,new_task,new_task.created_by,new_task.name,new_task.resource_subtype,resource_subtype,status" }; projectTemplatesApiInstance.instantiateProject(project_template_gid, opts).then((result) => { console.log('API called successfully. Returned data: ' + JSON.stringify(result.data, null, 2)); }, (error) => { console.error(error.response.body); }); ``` -------------------------------- ### GET /teams/{team_gid}/users Source: https://github.com/asana/node-asana/blob/master/README.md Get users in a team. ```APIDOC ## GET /teams/{team_gid}/users ### Description Get users in a team. ### Method GET ### Endpoint /teams/{team_gid}/users ``` -------------------------------- ### GET /user_task_lists/{user_task_list_gid} Source: https://github.com/asana/node-asana/blob/master/README.md Get a user task list. ```APIDOC ## GET /user_task_lists/{user_task_list_gid} ### Description Get a user task list. ### Method GET ### Endpoint /user_task_lists/{user_task_list_gid} ``` -------------------------------- ### basicAuth Source: https://github.com/asana/node-asana/wiki/Client.API Creates a Client for a user using that user's API Key and then authenticates through HTTP Basic Authentication. This is probably the easier method for command line scripts or bot like integrations. Handling "real" users should be preferably done with OAuth. ```APIDOC ## basicAuth ### Description Creates a Client for a user using that user's API Key and then authenticates through HTTP Basic Authentication. This is probably the easier method for command line scripts or bot like integrations. Handling "real" users should be preferably done with OAuth. ### Method static ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example None ### Response #### Success Response (200) - **client** (Client) - The instantiated client #### Response Example None ``` -------------------------------- ### GET /timesheet_approval_statuses Source: https://github.com/asana/node-asana/blob/master/README.md Get multiple timesheet approval statuses. ```APIDOC ## GET /timesheet_approval_statuses ### Description Get multiple timesheet approval statuses. ### Method GET ### Endpoint /timesheet_approval_statuses ``` -------------------------------- ### GET /timesheet_approval_statuses/{timesheet_approval_status_gid} Source: https://github.com/asana/node-asana/blob/master/README.md Get a timesheet approval status. ```APIDOC ## GET /timesheet_approval_statuses/{timesheet_approval_status_gid} ### Description Get a timesheet approval status. ### Method GET ### Endpoint /timesheet_approval_statuses/{timesheet_approval_status_gid} ``` -------------------------------- ### Instantiate a Task from a Task Template Source: https://github.com/asana/node-asana/blob/master/docs/TaskTemplatesApi.md Use this method to create a job that asynchronously handles task instantiation from a given task template. Ensure you have authenticated the client and provided the task template GID. The `opts` object can include a `body` for task details and `opt_fields` to specify returned properties. ```javascript const Asana = require('asana'); let client = new Asana.ApiClient(); client.authentications.token.accessToken = ''; let taskTemplatesApiInstance = new Asana.TaskTemplatesApi(client); let task_template_gid = "1331"; // String | Globally unique identifier for the task template. let opts = { 'body': {"data": {"": "", "": "",}}, 'opt_fields': "new_graph_export,new_graph_export.completed_at,new_graph_export.created_at,new_graph_export.download_url,new_portfolio,new_portfolio.name,new_project,new_project.name,new_project_template,new_project_template.name,new_resource_export,new_resource_export.completed_at,new_resource_export.created_at,new_resource_export.download_url,new_task,new_task.created_by,new_task.name,new_task.resource_subtype,resource_subtype,status" }; taskTemplatesApiInstance.instantiateTask(task_template_gid, opts).then((result) => { console.log('API called successfully. Returned data: ' + JSON.stringify(result.data, null, 2)); }, (error) => { console.error(error.response.body); }); ``` -------------------------------- ### GET /time_tracking_entries/{time_tracking_entry_gid} Source: https://github.com/asana/node-asana/blob/master/README.md Get a time tracking entry. ```APIDOC ## GET /time_tracking_entries/{time_tracking_entry_gid} ### Description Get a time tracking entry. ### Method GET ### Endpoint /time_tracking_entries/{time_tracking_entry_gid} ``` -------------------------------- ### POST - create a task Source: https://github.com/asana/node-asana/blob/master/README.md Creates a new task with specified details such as name, assignee, project, and notes. ```APIDOC ## POST /tasks ### Description Creates a new task in Asana. You can specify various properties like name, assignee, project, notes, and more. ### Method POST ### Endpoint /tasks ### Parameters #### Request Body - **data** (Object) - Required - The task object to create. - **name** (String) - Required - The name of the task. - **approval_status** (String) - Optional - The approval status of the task. - **assignee_status** (String) - Optional - The assignee status of the task. - **completed** (Boolean) - Optional - Whether the task is completed. - **external** (Object) - Optional - An object containing external task details. - **html_notes** (String) - Optional - HTML formatted notes for the task. - **is_rendered_as_separator** (Boolean) - Optional - Whether the task is rendered as a separator. - **liked** (Boolean) - Optional - Whether the task is liked. - **assignee** (String) - Optional - The GID of the user to assign the task to, or 'me' to assign to the current user. - **projects** (Array) - Optional - An array of project GIDs to which the task belongs. ### Request Example ```javascript let body = { "data": { "name": "New Task", "approval_status": "pending", "assignee_status": "upcoming", "completed": false, "external": { "gid": "1234", "data": "A blob of information." }, "html_notes": "Mittens really likes the stuff from Humboldt.", "is_rendered_as_separator": false, "liked": true, "assignee": "me", "projects": [""] } }; tasksApiInstance.createTask(body).then((result) => { console.log('API called successfully. Returned data: ' + JSON.stringify(result.data, null, 2)); }).catch((error) => { console.error(error.response.body); }); ``` ### Response #### Success Response (201) - **data** (Object) - The newly created task object. #### Response Example ```json { "data": { "gid": "67890", "name": "New Task" } } ``` ``` -------------------------------- ### Create a Portfolio Source: https://github.com/asana/node-asana/blob/master/docs/PortfoliosApi.md Use this snippet to create a new portfolio in a specified workspace. You can customize the portfolio's initial state and include optional fields for detailed configuration. Ensure you have the 'portfolios:write' scope. ```javascript const Asana = require('asana'); let client = new Asana.ApiClient(); client.authentications.token.accessToken = ''; let portfoliosApiInstance = new Asana.PortfoliosApi(client); let body = {"data": {"": "", "": "",}}; // Object | The portfolio to create. let opts = { 'opt_fields': "archived,color,created_at,created_by,created_by.name,current_status_update,current_status_update.resource_subtype,current_status_update.title,custom_field_settings,custom_field_settings.custom_field,custom_field_settings.custom_field.asana_created_field,custom_field_settings.custom_field.created_by,custom_field_settings.custom_field.created_by.name,custom_field_settings.custom_field.currency_code,custom_field_settings.custom_field.custom_label,custom_field_settings.custom_field.custom_label_position,custom_field_settings.custom_field.date_value,custom_field_settings.custom_field.date_value.date,custom_field_settings.custom_field.date_value.date_time,custom_field_settings.custom_field.default_access_level,custom_field_settings.custom_field.description,custom_field_settings.custom_field.display_value,custom_field_settings.custom_field.enabled,custom_field_settings.custom_field.enum_options,custom_field_settings.custom_field.enum_options.color,custom_field_settings.custom_field.enum_options.enabled,custom_field_settings.custom_field.enum_options.name,custom_field_settings.custom_field.enum_value,custom_field_settings.custom_field.enum_value.color,custom_field_settings.custom_field.enum_value.enabled,custom_field_settings.custom_field.enum_value.name,custom_field_settings.custom_field.format,custom_field_settings.custom_field.has_notifications_enabled,custom_field_settings.custom_field.html_text_value,custom_field_settings.custom_field.id_prefix,custom_field_settings.custom_field.input_restrictions,custom_field_settings.custom_field.is_formula_field,custom_field_settings.custom_field.is_global_to_workspace,custom_field_settings.custom_field.is_value_read_only,custom_field_settings.custom_field.multi_enum_values,custom_field_settings.custom_field.multi_enum_values.color,custom_field_settings.custom_field.multi_enum_values.enabled,custom_field_settings.custom_field.multi_enum_values.name,custom_field_settings.custom_field.name,custom_field_settings.custom_field.number_value,custom_field_settings.custom_field.people_value,custom_field_settings.custom_field.people_value.name,custom_field_settings.custom_field.precision,custom_field_settings.custom_field.privacy_setting,custom_field_settings.custom_field.reference_value,custom_field_settings.custom_field.reference_value.name,custom_field_settings.custom_field.representation_type,custom_field_settings.custom_field.resource_subtype,custom_field_settings.custom_field.text_value,custom_field_settings.custom_field.type,custom_field_settings.is_important,custom_field_settings.parent,custom_field_settings.parent.name,custom_field_settings.project,custom_field_settings.project.name,custom_fields,custom_fields.date_value,custom_fields.date_value.date,custom_fields.date_value.date_time,custom_fields.display_value,custom_fields.enabled,custom_fields.enum_options,custom_fields.enum_options.color,custom_fields.enum_options.enabled,custom_fields.enum_options.name,custom_fields.enum_value,custom_fields.enum_value.color,custom_fields.enum_value.enabled,custom_fields.enum_value.name,custom_fields.id_prefix,custom_fields.input_restrictions,custom_fields.is_formula_field,custom_fields.multi_enum_values,custom_fields.multi_enum_values.color,custom_fields.multi_enum_values.enabled,custom_fields.multi_enum_values.name,custom_fields.name,custom_fields.number_value,custom_fields.representation_type,custom_fields.text_value,custom_fields.type,default_access_level,due_on,members,members.name,name,owner,owner.name,permalink_url,privacy_setting,project_templates,project_templates.name,public,start_on,workspace,workspace.name" }; portfoliosApiInstance.createPortfolio(body, opts).then((result) => { console.log('API called successfully. Returned data: ' + JSON.stringify(result.data, null, 2)); }, (error) => { console.error(error.response.body); }); ``` -------------------------------- ### GET /time_tracking_entries Source: https://github.com/asana/node-asana/blob/master/README.md Get multiple time tracking entries. ```APIDOC ## GET /time_tracking_entries ### Description Get multiple time tracking entries. ### Method GET ### Endpoint /time_tracking_entries ``` -------------------------------- ### Create Project Template from Project Source: https://github.com/asana/node-asana/blob/master/docs/ProjectsApi.md Use this snippet to create a project template from an existing project. Ensure you have your access token and the correct project GID. The body object defines the new template's name and team. ```javascript const Asana = require('asana'); let client = new Asana.ApiClient(); client.authentications.token.accessToken = ''; let projectsApiInstance = new Asana.ProjectsApi(client); let body = {"data": {"": "", "": "",}}; // Object | Describes the inputs used for creating a project template, such as the resulting project template's name, which team it should be created in. let project_gid = "1331"; // String | Globally unique identifier for the project. let opts = { 'opt_fields': "new_graph_export,new_graph_export.completed_at,new_graph_export.created_at,new_graph_export.download_url,new_portfolio,new_portfolio.name,new_project,new_project.name,new_project_template,new_project_template.name,new_resource_export,new_resource_export.completed_at,new_resource_export.created_at,new_resource_export.download_url,new_task,new_task.created_by,new_task.name,new_task.resource_subtype,resource_subtype,status" }; projectsApiInstance.projectSaveAsTemplate(body, project_gid, opts).then((result) => { console.log('API called successfully. Returned data: ' + JSON.stringify(result.data, null, 2)); }, (error) => { console.error(error.response.body); }); ``` -------------------------------- ### GET /users/{user_gid}/workspace_memberships Source: https://github.com/asana/node-asana/blob/master/README.md Get workspace memberships for a user. ```APIDOC ## GET /users/{user_gid}/workspace_memberships ### Description Get workspace memberships for a user. ### Method GET ### Endpoint /users/{user_gid}/workspace_memberships ``` -------------------------------- ### GET /workspaces/{workspace_gid}/users Source: https://github.com/asana/node-asana/blob/master/README.md Get users in a workspace or organization. ```APIDOC ## GET /workspaces/{workspace_gid}/users ### Description Get users in a workspace or organization. ### Method GET ### Endpoint /workspaces/{workspace_gid}/users ``` -------------------------------- ### Asana.MembershipsApi.createMembership Source: https://github.com/asana/node-asana/blob/master/README.md Create a membership. ```APIDOC ## POST /memberships ### Description Create a membership. ### Method POST ### Endpoint /memberships ``` -------------------------------- ### Get Project Portfolio Settings For Project Source: https://github.com/asana/node-asana/blob/master/docs/ProjectPortfolioSettingsApi.md Retrieves a compact representation of all project portfolio settings for a given project. Requires `project_portfolio_settings:read` scope. ```APIDOC ## Get Project Portfolio Settings For Project ### Description Get project portfolio settings for a project. Returns a compact representation of all of the project portfolio settings for the given project. ### Method GET ### Endpoint /projects/:project_gid/portfolio_settings ### Parameters #### Path Parameters - **project_gid** (String) - Required - Globally unique identifier for the project. #### Query Parameters - **limit** (Number) - Optional - Results per page. The number of objects to return per page. The value must be between 1 and 100. - **offset** (String) - Optional - 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.* - **opt_fields** (Object) - Optional - This endpoint returns a 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. ### Response #### Success Response (200) - **data** (object) - A representation of the project portfolio settings. ### Response Example { "data": { "created_at": "2023-10-27T10:00:00.000Z", "is_access_control_inherited": false, "offset": "some_offset_token", "path": "/portfolio/12345/project/1331", "portfolio": { "gid": "12345", "name": "Portfolio Name" }, "project": { "gid": "1331", "name": "Project Name" }, "uri": "/portfolio_settings/abcde" } } ``` -------------------------------- ### GET /users/{user_gid}/favorites Source: https://github.com/asana/node-asana/blob/master/README.md Get a user's favorites. ```APIDOC ## GET /users/{user_gid}/favorites ### Description Get a user's favorites. ### Method GET ### Endpoint /users/{user_gid}/favorites ``` -------------------------------- ### Asana.GoalsApi.createGoal Source: https://github.com/asana/node-asana/blob/master/README.md Create a new goal. ```APIDOC ## POST /goals ### Description Create a new goal. ### Method POST ### Endpoint /goals ``` -------------------------------- ### GET /workspaces/{workspace_gid}/typeahead Source: https://github.com/asana/node-asana/blob/master/README.md Get objects via typeahead. ```APIDOC ## GET /workspaces/{workspace_gid}/typeahead ### Description Get objects via typeahead. ### Method GET ### Endpoint /workspaces/{workspace_gid}/typeahead ```