How to retrieve Related Portfolios on a Project

  • I have a project ID
  • I have successfully retrieved the data about the project from the API (https://app.asana.com/api/1.0/projects/{MyID})
  • In the response of this API, I want a list of all the related portfolios, so that I can get information about the portfolio owners.
  • Based on my observations, the API does not show information about related portfolios

My question is, how can I retrieve the related portfolios for my project? In the end, I want to know who are the owners of those related portfolios, and display information from their profiles.

Hi @Saahir_Foux and welcome to the forum,

I’m not aware of any way to directly retrieve a list of the portfolios that a given project is contained in.

@Bastien_Siebman do you know of any way to get that in the API?

I’m also checking with the Asana API team.

Indeed for me it is the other way around, you need to query for portfolios to see what projects they contain.

Sadly, that is the approach my team also suggested. It’s inefficient, but that appears to also be the only way until the Asana Team releases an update to resolve this.

My tries:
me = asana.Client.access_token([‘PERSONAL_ACCESS_TOKEN’]).users.me()
portfolios=asana_client.portfolios.get_portfolios({‘workspace’:int(me[‘workspaces’][0][‘gid’]),‘owner’:int(me[‘gid’])}, opt_pretty=True)

Only problem is if I am not the owner, I wont get data…

We would hope/want this for work for a reader, as a reader can see related portfolios per project in UI, isnt it.

Like @Bastien_Siebman said I would want to populate portfolios and projects list and then group concat for getting portfolios per project.

But is there a workaround for getting things without one being owner of projects.

I believe your problem lies with this sentence in the doc, within the “get multiple portfolios” section:

Returns a list of the portfolios in compact representation that are owned by the current API user

Apparently you can’t list all portfolios you can see in the UI, but only the ones you own :frowning: UNLESS you have the portfolios id already I suppose and you can get them one by one.

Is there any way around this yet? It’s surely a common need to list portfolios that you aren’t an owner of, or if you don’t know the owner ID.

Hi @anon18255156, have you managed to find a workaround for listing portfolios? Service account would solve that but I need to support the API user case

Right now, I have a workflow that manages portfolio memberships for our projects. It has a point where it needs to find all the portfolios a project is in. Right now to do this, I go through all our portfolios and check whether projects are in each of them, which is unwieldy.

Is there an api endpoint that would give me all the portfolios associated with a project?

Hi @Emma_Wadsworth and welcome to the forum,

I’ve merged your post with an existing thread on this topic. Unfortunately as you can see above, it’s not possible; you have to go the other direction by retrieving portfolios and getting a list of the projects in the portfolio.