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 ({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.

1 Like

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’])
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.

1 Like