How to match user ID and profile ID

We are considering using the API to externally back up data, including comments.

We have a problem.
When using the API to extract comments (Stories) that mention members, they are extracted as profile IDs rather than member IDs.
We want to know members by user IDs.
For that reason, we would like to know how to link profile IDs with user IDs.
We have checked the API documentation but cannot find the answer.

If you know, please let me know.

Finally, I apologize for my poor English, but I would appreciate your help.

Hi @市川_智一

The data-asana-gid portion of the returned tag is their User gid.

See Rich Text, especially this part:

Suppose a user with a name of "Tim" and a user GID of "53421" is @-mentioned. This will create a link to their "My Tasks" which is a project with a GID of "56789"
* The raw link generated in Asana will be https://app.asana.com/0/56789/list.
* The <a> tag returned in the API will be <a href="https://app.asana.com/0/56789/list" data-asana-accessible="true" data-asana-dynamic="true" data-asana-type="user" data-asana-gid="54321">@Tim</a>.

Hi, I’m using the stories api to extract comments - {ASANA_BASE_URL}/tasks/{task_gid}/stories - when I find a comment i see it as text only (no html_text) and what looks to be a profile id instead of a user id.

Is there a way to go from this profile id to the user id I need? Willing to make as many api calls as needed to find this.

“John said: app.asana.com/0/1202646525507297/list what do you mean?”

Trying this right now shows that the number isn’t the user id but possibly a profile id?:

requests.get( “https://app.asana.com/api/1.0/users/1202646525507297”, headers=headers_asana)

How does one go from this url to the user’s name?

Hi @Ameen_Jivani and welcome to the forum,

FYI I moved your post to an existing thread on this topic.

As it mentions above, you’ll need to use the html_text property which contains the full tag including data-asana-gid which is the User Id.

You’ll need to use opt_fields to get the html_text, as in

{ASANA_BASE_URL}/tasks/{task_gid}/stories?opt_fields=html_text

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.