Skip to content

Latest commit

 

History

History
236 lines (173 loc) · 12.3 KB

TeamMembershipsApi.md

File metadata and controls

236 lines (173 loc) · 12.3 KB

asana.TeamMembershipsApi

All URIs are relative to https://app.asana.com/api/1.0

Method HTTP request Description
get_team_membership GET /team_memberships/{team_membership_gid} Get a team membership
get_team_memberships GET /team_memberships Get team memberships
get_team_memberships_for_team GET /teams/{team_gid}/team_memberships Get memberships from a team
get_team_memberships_for_user GET /users/{user_gid}/team_memberships Get memberships from a user

get_team_membership

Get a team membership

Returns the complete team membership record for a single team membership.

(more information)

Example

import asana
from asana.rest import ApiException
from pprint import pprint

configuration = asana.Configuration()
configuration.access_token = '<YOUR_ACCESS_TOKEN>'
api_client = asana.ApiClient(configuration)

# create an instance of the API class
team_memberships_api_instance = asana.TeamMembershipsApi(api_client)
team_membership_gid = "724362" # str | 
opts = {
    'opt_fields': "is_admin,is_guest,is_limited_access,team,team.name,user,user.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.
}

try:
    # Get a team membership
    api_response = team_memberships_api_instance.get_team_membership(team_membership_gid, opts)
    pprint(api_response)
except ApiException as e:
    print("Exception when calling TeamMembershipsApi->get_team_membership: %s\n" % e)

Parameters

Name Type Description Notes
team_membership_gid str
opt_fields Dict 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]

Return type

dict

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json; charset=UTF-8

[Back to top] [Back to API list] [Back to README]

get_team_memberships

Get team memberships

Returns compact team membership records.

(more information)

Example

import asana
from asana.rest import ApiException
from pprint import pprint

configuration = asana.Configuration()
configuration.access_token = '<YOUR_ACCESS_TOKEN>'
api_client = asana.ApiClient(configuration)

# create an instance of the API class
team_memberships_api_instance = asana.TeamMembershipsApi(api_client)
opts = {
    'limit': 50, # int | Results per page. The number of objects to return per page. The value must be between 1 and 100.
    '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.'
    'team': "159874", # str | Globally unique identifier for the team.
    'user': "512241", # str | A string identifying a user. This can either be the string \"me\", an email, or the gid of a user. This parameter must be used with the workspace parameter.
    'workspace': "31326", # str | Globally unique identifier for the workspace. This parameter must be used with the user parameter.
    'opt_fields': "is_admin,is_guest,is_limited_access,offset,path,team,team.name,uri,user,user.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.
}

try:
    # Get team memberships
    api_response = team_memberships_api_instance.get_team_memberships(opts)
    for data in api_response:
        pprint(data)
except ApiException as e:
    print("Exception when calling TeamMembershipsApi->get_team_memberships: %s\n" % e)

Parameters

Name Type Description Notes
limit int Results per page. The number of objects to return per page. The value must be between 1 and 100. [optional]
offset 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.' [optional]
team str Globally unique identifier for the team. [optional]
user str A string identifying a user. This can either be the string &quot;me&quot;, an email, or the gid of a user. This parameter must be used with the workspace parameter. [optional]
workspace str Globally unique identifier for the workspace. This parameter must be used with the user parameter. [optional]
opt_fields Dict 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]

Return type

generator

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json; charset=UTF-8

[Back to top] [Back to API list] [Back to README]

get_team_memberships_for_team

Get memberships from a team

Returns the compact team memberships for the team.

(more information)

Example

import asana
from asana.rest import ApiException
from pprint import pprint

configuration = asana.Configuration()
configuration.access_token = '<YOUR_ACCESS_TOKEN>'
api_client = asana.ApiClient(configuration)

# create an instance of the API class
team_memberships_api_instance = asana.TeamMembershipsApi(api_client)
team_gid = "159874" # str | Globally unique identifier for the team.
opts = {
    'limit': 50, # int | Results per page. The number of objects to return per page. The value must be between 1 and 100.
    '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.'
    'opt_fields': "is_admin,is_guest,is_limited_access,offset,path,team,team.name,uri,user,user.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.
}

try:
    # Get memberships from a team
    api_response = team_memberships_api_instance.get_team_memberships_for_team(team_gid, opts)
    for data in api_response:
        pprint(data)
except ApiException as e:
    print("Exception when calling TeamMembershipsApi->get_team_memberships_for_team: %s\n" % e)

Parameters

Name Type Description Notes
team_gid str Globally unique identifier for the team.
limit int Results per page. The number of objects to return per page. The value must be between 1 and 100. [optional]
offset 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.' [optional]
opt_fields Dict 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]

Return type

generator

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json; charset=UTF-8

[Back to top] [Back to API list] [Back to README]

get_team_memberships_for_user

Get memberships from a user

Returns the compact team membership records for the user.

(more information)

Example

import asana
from asana.rest import ApiException
from pprint import pprint

configuration = asana.Configuration()
configuration.access_token = '<YOUR_ACCESS_TOKEN>'
api_client = asana.ApiClient(configuration)

# create an instance of the API class
team_memberships_api_instance = asana.TeamMembershipsApi(api_client)
user_gid = "me" # str | A string identifying a user. This can either be the string \"me\", an email, or the gid of a user.
workspace = "31326" # str | Globally unique identifier for the workspace.
opts = {
    'limit': 50, # int | Results per page. The number of objects to return per page. The value must be between 1 and 100.
    '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.'
    'opt_fields': "is_admin,is_guest,is_limited_access,offset,path,team,team.name,uri,user,user.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.
}

try:
    # Get memberships from a user
    api_response = team_memberships_api_instance.get_team_memberships_for_user(user_gid, workspace, opts)
    for data in api_response:
        pprint(data)
except ApiException as e:
    print("Exception when calling TeamMembershipsApi->get_team_memberships_for_user: %s\n" % e)

Parameters

Name Type Description Notes
user_gid str A string identifying a user. This can either be the string &quot;me&quot;, an email, or the gid of a user.
workspace str Globally unique identifier for the workspace.
limit int Results per page. The number of objects to return per page. The value must be between 1 and 100. [optional]
offset 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.' [optional]
opt_fields Dict 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]

Return type

generator

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json; charset=UTF-8

[Back to top] [Back to API list] [Back to README]