How to resolve a "user id" in a story comment


#1

When I issue this request: https://app.asana.com/api/1.0/tasks//stories?opt_pretty I get back the comments that I am looking for. These are going to be displayed in my Windows application. I don’t know if this is common to all asana users, but in asana (not the api) when we make comments we can say @ and it resolves to a user. But then in the comment it’s a link like https://app.asana.com/0//list. Is there a way to take and translate it back into the user? This id is not the same id that is listed when I run GetUsersInWorkspace to get the list of users so I can’t use that.

Thank you.


#2

Sorry, when I posted that question some things were edited out that I had wrapped with less than greater than symbols. I hope my point is clear. Please let me know if it doesn’t make sense.


#3

See here for the answer.


#4

Awesome, thank you!
I don’t know if my code would be useful to anyone. I wrote a routine named GetTextWithMentionsResolved() and I call it recursively until I’ve resolved all the links. Also, I wrote these classes that someone might also benefit from. I would think they existed, but my internet was down so I just wrote them myself based on the json I got back. I don’t know if many others are using C#.
/************* This is to parse the “mention” *************/
public class MyClassY
{
// I don’t think this one is a list
public RootObjectY data { get; set; }
}
public class RootObjectY
{
public string id { get; set; }
public string archived { get; set; }
public string color { get; set; }
public string created_at { get; set; }
public string current_status { get; set; }
public string due_date { get; set; }
public List followers { get; set; }
public string layout { get; set; }
public List members { get; set; }
public string modified_at { get; set; }
public string name { get; set; }
public string notes { get; set; }
public Owner owner { get; set; }
public string publick { get; set; } // Couldn’t call it public, LOL
public string start_on { get; set; }
public string team { get; set; }
public Workspace workspace { get; set; }
}
public class Workspace
{
public string id { get; set; }
public string name { get; set; }
}
public class Followers
{
public string id { get; set; }
public string name { get; set; }
}

// I'm guessing on this one.  It's blank:  "members" : [ ],
public class Members
{
    public string id { get; set; }
    public string name { get; set; }
}
public class Owner
{
    public string id { get; set; }
    public string name { get; set; }
}

#5

I still don’t know why formatting kicks in half way through the code I post…