All URIs are relative to https://app.asana.com/api/1.0
Method | HTTP request | Description |
---|---|---|
addUserForTeam | POST /teams/{team_gid}/addUser | Add a user to a team |
createTeam | POST /teams | Create a team |
getTeam | GET /teams/{team_gid} | Get a team |
getTeamsForUser | GET /users/{user_gid}/teams | Get teams for a user |
getTeamsForWorkspace | GET /workspaces/{workspace_gid}/teams | Get teams in a workspace |
removeUserForTeam | POST /teams/{team_gid}/removeUser | Remove a user from a team |
updateTeam | PUT /teams/{team_gid} | Update a team |
Add a user to a team
The user making this call must be a member of the team in order to add others. The user being added must exist in the same organization as the team. Returns the complete team membership record for the newly added user.
const Asana = require('asana');
let client = Asana.ApiClient.instance;
let token = client.authentications['token'];
token.accessToken = '<YOUR_ACCESS_TOKEN>';
let teamsApiInstance = new Asana.TeamsApi();
let body = {"data": {"<PARAM_1>": "<VALUE_1>", "<PARAM_2>": "<VALUE_2>",}}; // Object | The user to add to the team.
let team_gid = "159874"; // String | Globally unique identifier for the team.
let opts = {
'opt_fields': "is_admin,is_guest,is_limited_access,team,team.name,user,user.name"
};
teamsApiInstance.addUserForTeam(body, team_gid, opts).then((result) => {
console.log('API called successfully. Returned data: ' + JSON.stringify(result.data, null, 2));
}, (error) => {
console.error(error.response.body);
});
Name | Type | Description | Notes |
---|---|---|---|
body | Object | The user to add to the team. | |
team_gid | String | Globally unique identifier for the team. | |
opt_fields | Object | 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. | [optional] |
object
- Content-Type: application/json; charset=UTF-8
- Accept: application/json; charset=UTF-8
Create a team
Creates a team within the current workspace.
const Asana = require('asana');
let client = Asana.ApiClient.instance;
let token = client.authentications['token'];
token.accessToken = '<YOUR_ACCESS_TOKEN>';
let teamsApiInstance = new Asana.TeamsApi();
let body = {"data": {"<PARAM_1>": "<VALUE_1>", "<PARAM_2>": "<VALUE_2>",}}; // Object | The team to create.
let opts = {
'opt_fields': "description,edit_team_name_or_description_access_level,edit_team_visibility_or_trash_team_access_level,guest_invite_management_access_level,html_description,join_request_management_access_level,member_invite_management_access_level,name,organization,organization.name,permalink_url,team_content_management_access_level,team_member_removal_access_level,visibility"
};
teamsApiInstance.createTeam(body, opts).then((result) => {
console.log('API called successfully. Returned data: ' + JSON.stringify(result.data, null, 2));
}, (error) => {
console.error(error.response.body);
});
Name | Type | Description | Notes |
---|---|---|---|
body | Object | The team to create. | |
opt_fields | Object | 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. | [optional] |
object
- Content-Type: application/json; charset=UTF-8
- Accept: application/json; charset=UTF-8
Get a team
Returns the full record for a single team.
const Asana = require('asana');
let client = Asana.ApiClient.instance;
let token = client.authentications['token'];
token.accessToken = '<YOUR_ACCESS_TOKEN>';
let teamsApiInstance = new Asana.TeamsApi();
let team_gid = "159874"; // String | Globally unique identifier for the team.
let opts = {
'opt_fields': "description,edit_team_name_or_description_access_level,edit_team_visibility_or_trash_team_access_level,guest_invite_management_access_level,html_description,join_request_management_access_level,member_invite_management_access_level,name,organization,organization.name,permalink_url,team_content_management_access_level,team_member_removal_access_level,visibility"
};
teamsApiInstance.getTeam(team_gid, opts).then((result) => {
console.log('API called successfully. Returned data: ' + JSON.stringify(result.data, null, 2));
}, (error) => {
console.error(error.response.body);
});
Name | Type | Description | Notes |
---|---|---|---|
team_gid | String | Globally unique identifier for the team. | |
opt_fields | Object | 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. | [optional] |
object
- Content-Type: Not defined
- Accept: application/json; charset=UTF-8
Get teams for a user
Returns the compact records for all teams to which the given user is assigned.
const Asana = require('asana');
let client = Asana.ApiClient.instance;
let token = client.authentications['token'];
token.accessToken = '<YOUR_ACCESS_TOKEN>';
let teamsApiInstance = new Asana.TeamsApi();
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 organization = "1331"; // String | The workspace or organization to filter teams on.
let opts = {
'limit': 50,
'offset': "eyJ0eXAiOJiKV1iQLCJhbGciOiJIUzI1NiJ9",
'opt_fields': "description,edit_team_name_or_description_access_level,edit_team_visibility_or_trash_team_access_level,guest_invite_management_access_level,html_description,join_request_management_access_level,member_invite_management_access_level,name,offset,organization,organization.name,path,permalink_url,team_content_management_access_level,team_member_removal_access_level,uri,visibility"
};
teamsApiInstance.getTeamsForUser(user_gid, organization, opts).then((result) => {
console.log('API called successfully. Returned data: ' + JSON.stringify(result.data, null, 2));
}, (error) => {
console.error(error.response.body);
});
Name | Type | Description | Notes |
---|---|---|---|
user_gid | String | A string identifying a user. This can either be the string "me", an email, or the gid of a user. | |
organization | String | The workspace or organization to filter teams on. | |
limit | Number | Results per page. The number of objects to return per page. The value must be between 1 and 100. | [optional] |
offset | String | 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. | [optional] |
opt_fields | Object | 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. | [optional] |
object
- Content-Type: Not defined
- Accept: application/json; charset=UTF-8
Get teams in a workspace
Returns the compact records for all teams in the workspace visible to the authorized user.
const Asana = require('asana');
let client = Asana.ApiClient.instance;
let token = client.authentications['token'];
token.accessToken = '<YOUR_ACCESS_TOKEN>';
let teamsApiInstance = new Asana.TeamsApi();
let workspace_gid = "12345"; // String | Globally unique identifier for the workspace or organization.
let opts = {
'limit': 50,
'offset': "eyJ0eXAiOJiKV1iQLCJhbGciOiJIUzI1NiJ9",
'opt_fields': "description,edit_team_name_or_description_access_level,edit_team_visibility_or_trash_team_access_level,guest_invite_management_access_level,html_description,join_request_management_access_level,member_invite_management_access_level,name,offset,organization,organization.name,path,permalink_url,team_content_management_access_level,team_member_removal_access_level,uri,visibility"
};
teamsApiInstance.getTeamsForWorkspace(workspace_gid, opts).then((result) => {
console.log('API called successfully. Returned data: ' + JSON.stringify(result.data, null, 2));
}, (error) => {
console.error(error.response.body);
});
Name | Type | Description | Notes |
---|---|---|---|
workspace_gid | String | Globally unique identifier for the workspace or organization. | |
limit | Number | Results per page. The number of objects to return per page. The value must be between 1 and 100. | [optional] |
offset | String | 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. | [optional] |
opt_fields | Object | 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. | [optional] |
object
- Content-Type: Not defined
- Accept: application/json; charset=UTF-8
Remove a user from a team
The user making this call must be a member of the team in order to remove themselves or others.
const Asana = require('asana');
let client = Asana.ApiClient.instance;
let token = client.authentications['token'];
token.accessToken = '<YOUR_ACCESS_TOKEN>';
let teamsApiInstance = new Asana.TeamsApi();
let body = {"data": {"<PARAM_1>": "<VALUE_1>", "<PARAM_2>": "<VALUE_2>",}}; // Object | The user to remove from the team.
let team_gid = "159874"; // String | Globally unique identifier for the team.
teamsApiInstance.removeUserForTeam(body, team_gid).then((result) => {
console.log('API called successfully. Returned data: ' + JSON.stringify(result.data, null, 2));
}, (error) => {
console.error(error.response.body);
});
Name | Type | Description | Notes |
---|---|---|---|
body | Object | The user to remove from the team. | |
team_gid | String | Globally unique identifier for the team. |
object
- Content-Type: application/json; charset=UTF-8
- Accept: application/json; charset=UTF-8
Update a team
Updates a team within the current workspace.
const Asana = require('asana');
let client = Asana.ApiClient.instance;
let token = client.authentications['token'];
token.accessToken = '<YOUR_ACCESS_TOKEN>';
let teamsApiInstance = new Asana.TeamsApi();
let body = {"data": {"<PARAM_1>": "<VALUE_1>", "<PARAM_2>": "<VALUE_2>",}}; // Object | The team to update.
let team_gid = "159874"; // String | Globally unique identifier for the team.
let opts = {
'opt_fields': "description,edit_team_name_or_description_access_level,edit_team_visibility_or_trash_team_access_level,guest_invite_management_access_level,html_description,join_request_management_access_level,member_invite_management_access_level,name,organization,organization.name,permalink_url,team_content_management_access_level,team_member_removal_access_level,visibility"
};
teamsApiInstance.updateTeam(body, team_gid, opts).then((result) => {
console.log('API called successfully. Returned data: ' + JSON.stringify(result.data, null, 2));
}, (error) => {
console.error(error.response.body);
});
Name | Type | Description | Notes |
---|---|---|---|
body | Object | The team to update. | |
team_gid | String | Globally unique identifier for the team. | |
opt_fields | Object | 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. | [optional] |
object
- Content-Type: application/json; charset=UTF-8
- Accept: application/json; charset=UTF-8