0

Asana accounts can have multiple emails associated to them, but getting a user from the API only returns 1 email. So which one will it return? Is there a concept of a primary email?

https://app.asana.com/api/1.0/users/me

Marc
  • 3,243
  • 3
  • 23
  • 26

1 Answers1

0

Great question. Users typically have multiple email addresses when they are in multiple domains. If the API call has a domain context, such as GET /workspaces/:id/users the email addresses for each user will be their registered domain email for the workspace identified. This goes for querying followers of projects and tasks as they can only exist in a single domain.

However, when your query does not have a domain context, such as GET /users/me the behavior is a bit more undefined. The reply will not change from call to call unless the user has changed that email address, but there is not a notion of a "primary" email address you, as an API consumer, can apply to that response.

Hope that helps.

Andrew Noonan
  • 848
  • 6
  • 13
  • Got it. The reason I ask is when creating or upating a task, the API seems to accept an email address for the assignee field (on top of accepting a user ID). But given that email-user relations are not super well defined, well I guess it's not such a good idea to use emails. – Marc Sep 04 '15 at 15:09
  • Also quick note about personal workspaces. `GET /workspaces/:id-of-personal-workspace/users` always returns an empty list. Might want to mention some of these personal workspace quirks in the API doc. – Marc Sep 04 '15 at 15:10
  • I think you are on the right track here. Although the API does accept email addresses to reference users in most places, those associations are not guaranteed and less defined than using the globally unique ID for that user. Proceed at your own risk :) As you may have noticed, personal projects is a quirk all around, thank you for the feedback on docs, I will try to mention that bit of odd behavior somewhere. – Andrew Noonan Sep 08 '15 at 18:16