JSON representation of "notes" field supplies URL when using @name

api

#1

example:
in the notes(which is named description in the gui), the follow text was entered
Pair: @USERSNAME

HTML is displayed on the screen in the as {users.name}

when using the API and getting the text of the task:

Pair: https://app.asana.com/0/{users_id}/list


#2

its not the user_id in the URL… its a list context for that users ticket.


#3

Hi @chris.osborn,

Yes, the URL of the user’s My Tasks list is what is actually stored in the database. It automatically gets linked in the Asana product to the name of the user, but our API just exposes what is stored. This is a sticky issue and others have requested that we provide more information through our API in order to support knowing who was mentioned. We’ll likely provide this in a more intuitive way in a future version of our API.

One thing you can do is to ask for the html_text field on the story (it’s not returned by default, so you’ll have to explicitly ask for it in opt_fields). This will give you the url and the person’s name in a hyperlink tag, i.e.

<a href=\"https://app.asana.com/0/my_tasks_id/my_tasks_id\">User Name</a>

It’s kind of gnarly, but If you need the user’s ID from this info, since the ID is the “My Tasks” ID and not the user’s ID, there is a workaround. You can use the id that comes back with the URL (i.e. the target of the link is https://app.asana.com/api/1.0/{project_id}/{project_id}), then fetch that project’s info from the API at https://app.asana.com/api/1.0/projects/{project_id}. A persons My Task project will have only one user in the followers field - the owner of the project. This user’s info will be their name and ID.

Hopefully this will get things sorted out, and thanks for the feedback!