Asana: User deletion failed

Hi Team,

User creation failed using the user management APIs for one of our mutual customer, Spin, with the following error message:

This can only be done by a workspace administrator.
Is there an endpoint that we can use to check whether the connected account is a workspace admin or not? We are using the documentation available at Build an app with Asana.

Request ( Timestamp: [2019-07-27 05:02:02,222])

curl -X POST -H “Connection: keep-alive” -H “Accept-Encoding: gzip, deflate” -H “Accept: /” -H “User-Agent: python-requests/2.15.1” -H “Authorization: Bearer Token” -H “Content-Length: 37” -d ‘{“data”: {“user”: “963857764184727”}}’ ‘https://app.asana.com/api/1.0/workspaces/297627858353593/removeUser

Response :

{
u’error’: u’admin_only’,
u’help’: u’For more information on API status codes and how to handle them, read the docs on ’
u’message’: u’Call restricted to workspace admins’,
u’user_message’: u’This can only be done by a workspace administrator.’
}

Hi @Parashuram_Joshi and welcome to the forum,

Yes, you should be able to get the Workspace Memberships for that user and look at the is_admin property; see:

(FYI this endpoint was just added a few days ago, so good timing on your question!)

1 Like

Thanks phil,
I am not getting is_admin and is_active fields in the response for an endpoint mentioned here.

Do we need to pass any param to fetch all details of workspace_membership object?

Yes, as it says in the documentation, that endpoint returns “the compact workspace membership records” - compact being the key word. In Asana terms, that means by default Asana just gives you the basic info (for performance reasons) and you’ll need to “opt in” to get the other fields. To do that, include opt_fields=is_active, is_admin in your query.

You can read all about opting in and opt_fields here: