New API resource: workspace memberships

Hello once more! (It’s been a busy week of announcements for us!) We have recently added a new resource to our API that provides more detail around users in the context of workspaces, called “workspace memberships.” These are similar to project memberships or portfolio memberships, and represent the join between a user and a workspace in Asana. These objects contain the following:

  • A reference to the user
  • A reference to the workspace
  • A reference to the user’s “My Tasks” in that workspace
  • Whether the user is a guest
  • Whether the user is an admin
  • Whether the user’s membership is still active

Here’s an example of one of these objects:

{
  "gid": "...",
  "is_active": true,
  "is_admin": false,
  "is_guest": false,
  "resource_type": "workspace_membership",
  "user_task_list": {
    "gid": "...",
    "name": "My Tasks in Asana, Inc",
    "resource_type": "user_task_list",
  },
  "user": {
    "gid": "...",
    "name": "Joe Trollo",
    "resource_type": "user",
  },
  "workspace": {
    "gid": "...",
    "name": "My Company, Inc",
    "resource_type": "workspace",
  },
}

You can fetch workspace memberships…

  • For a given user with GET /users/<user-gid>/workspace_memberships
  • For a given workspace with GET /workspace/<workspace-gid>/workspace_memberships
  • By GID with GET /workspace_memberships/<workspace-memberships-gid>

One important note: a user’s set of workspace memberships may not match their workspaces. If a user is removed from a workspace and then added back later, they would have multiple membership objects—the old inactive one and the new active one.

2 Likes

Hi @Joe_Trollo,

What about the user’s email address in a particular workspace? Wouldn’t that be something that would be appropriate to include in an object that’s the intersection of a user and a workspace?

Hi, I tought by reading this that I could finally get the list of inactive users in my workspace, but that doesn’t work. I have inactive users, but if I use the /workspaces_memberships, or /users, on that workspace, they are not returned.

But when I query workspaces_memberships of that specific user, I see see the membership object, with the “is_active = false” field.

Is it possible to get these inactive users using that endpoint?

Sorry for the delay responding here. For the different endpoints, we have slightly different queries in our backend. When getting a user’s memberships, the query we use does not filter by is_active, but the query we chose to use for getting a workspace’s memberships filters to is_active=true. It is possible for us to make this endpoint perform no filter by default and instead expose a query parameter in the API for clients that want the filter. I’ll file a task internally for this but we may not get to it soon.

1 Like