How to get parent portfolio list using API

Hi There,

I want to get the list of parent portfolios(only portfolios having sub-portfolios) using API
Any code sample would be a great help!

Thanks in advance,
Lija.

Hi,

Have you tried this via the UI? The best way to master the API is to perform the desired action via the UI and eavesdrop to see which calls the UI made to accomplish the action. In this case, the Portfolios page will reveal which API to use to retrieve Portfolios, and you can use the Web API link in the page footer to further explore the available parameters

 
HTH,
Ann

Hi @ganncamp ,

Thank you for your response.

In the UI I get the full list of portfolios, in the list most of them are sub-portfolios and a few of them are parent portfolios. But from the UI i can’t differentiate which of them are parent and which are sub-portfolios. Is there any way to make this differentiation?

I want to get the list of parent portfolios only.

Kindly help
Thanks You,
Lija.

Hi Lija,

Start by looking at what web services are used on this page. That will give you an idea of where to start looking in the Web API docs (link in your page footer).

 
Ann

Hi @ganncamp ,

In the UI I could not find any identification for parent portfolios, is there any identification available for parent portfolios?

Hi @Colin_SonarSource , could you please help me on this?

Hi @lijasalim,

Please don’t invoke people who aren’t involved in your thread.

What web service does the UI use to retrieve data?

 
Ann

Hi @ganncamp ,

Thank you for the information.
The portfolio list is populated using
https://server/api/views/search?p=1&ps=50

I wand to filter out parent portfolios only…
How can I do that? kindly help.

Lija.

Hi Lija,

When you went to look at the docs for that web service… did you notice anything? I’ll fast-forward a few exchanges here and say that you have to toggle ‘Show Internal API’ to see the docs on views/search (no idea why that’s still marked internal).

When I look at it, I see that there doesn’t seem to be a qualifier for only roots, but in that same set of views APIs, I do see one that’s specifically for that…

 
Ann

Hi @ganncamp ,

Could you please share the one you found? Does it meet my requirement, what you think?

Thanks you,
Lija.