Expand my Community achievements bar.

Latest Community Ideas Review is Out: Discover What’s New and What to Expect!

API - All Project within a Portfolio

Avatar

Level 1
I am looking to get all projects within a portfolio, but from what I have read on the explorer it does not look that simple (no search by portfolio id in projects and vice versa). Being new to the workfront API, I am running into a lot of complications...many of their modifier examples are not working for me. Looking for recommendations on how to do this in a streamlined way; I am ETLing via Alteryx. Thank you!
Topics

Topics help categorize Community content and increase your ability to discover relevant content.

9 Replies

Avatar

Level 2

Hi Hannah,

A Portfolio object holds a collection of its Projects. While I'm not familiar with the specific tech you are using to pull the data, here is an example REST string.

/attask/api/PORT/{ID}?fields=projects

You can test this via your browser while logged in. Just swap out the {ID} with a Portfolio ID: "https://<your instance>/attask/api/PORT/{ID}?fields=projects" - Screenshot attached.

As you mentioned search, this REST call would also return the same data, with no modifiers: /attask/api/PORT/search?ID={ID}&fields=projects

Let me know if you need more information. Thanks!0690z000007ZkKiAAK.png

Avatar

Level 1
Thank you Haven, it worked - very helpful! Do you have a recommended best means for getting all of the attributes about projects pulled in? I have a lot of custom fields that I need to GET. My first inclination is to take all the IDs obtained from this project and create another call or set of calls to get all of their attributes. I do not know much about collections. Is there a means to do this with the url I already have started? Best, Hannah

Avatar

Level 10
Hi Hannah, A method to return all the standard and custom fields of the projects in a portfolio in the one query is to instead do a project search, as follows: /attask/api/project/search?portfolioID=562979750065117ef4aede079d025be7&fields=*,parameterValues&$$LIMIT=100 Just replace the portfolio ID with whichever one you want to look within. You can also adjust the LIMIT=100 to whatever number of projects you want to return. Regards, David

Avatar

Level 2

I'll use the search syntax for these examples, but you can also use the direct REST calls as well.

Example: /attask/api/PORT/search?ID={ID}&fields=projects:parameterValues

This says, "For the Portfolio with this ID, give me it's collection of projects. On those projects, also return me the parameterValues (custom data field values)" - Screenshot attached.

In my screenshot, I only have one field on the Project custom form. If I had more than one, all would be shown. Let's say there was only one specific field you wanted to return that existed on each project. You can instead ask directly for that field. Since my field is named "Some Example Field" ... /attask/api/PORT/search?ID={ID}&fields=projects:DE:Some%20Example%20Field ... would also work. "DE:" is the identifier for your Custom Data.

It's also possible to "walk" the fields on each object to an extent. You can request nested collections up to 4 layers deep with direct API calls. We restrict anything deeper than four, as it's possible to make some really complex (and non-performant) API calls.

So, /attask/api/PORT/{ID}?fields=projects:category:categoryParameters:parameter is an OK API call, but if we request any further fields, the API will block us. This is why the search method is handy. You can search the object for the data you need, and avoid some of the mid-layer objects.

Thanks!

EDIT: The information David provided is also very relevant and helpful. Thanks David!0690z000007ZkKYAA0.png

Avatar

Level 10
Nice info Haven - I learnt something too :)

Avatar

Level 1
Hello Haven - Do you have a recommended best way to get all the issues out of the API that come in on project request queues? I noticed that there are no collections on Projects for issues, only tasks. I am wanting to call all standard workfront fields, as well as all custom fields, but it doesn't look like 'parameterValues' works with OPTASK. Can you confirm? Thank you!

Avatar

Community Advisor
Hi Hanna. As Issues (aka optasks) are "under" Projects, I'd suggest something like this: /attask/api/optask/search?fields=*,parameterValues and then append whatever additional criteria you need to restrict to the Projects you're interested (e.g. &projectID={ID}); or some other attribute of the project(s) such as whether they are a Request Queue (e.g. &project:queueDefID_Mod=notnull) Regards, Doug

Avatar

Level 1
Hello Doug - Thank you for the help! I can successfully get data back when I do the operations separately. I have not been able to successfully call all the fields with the project ID filter. When I use OPTASK/search?projectID={ID}&search?fields=*,parameterValues I get the below error. {"error":{"class":"java.lang.IllegalArgumentException","message":"APIModel V6_0 does not support field search?fields (OpTask)"}} When I use /OPTASK/search?projectID={ID} without calling all the fields, I get data back so I know it is the correct project id. Am I doing something wrong or is this not possible? I tried reversing the order of the project id filter and the column requests as well. Thank you!

Avatar

Community Advisor
Hi Hanna. Perhaps this example ( substituting as needed) will help: it returns all Issues for a particular Project, including all Issue Values, Issue Parameter Values, Project Values, and Project Parameter Values. https:// yourdomain .attask-ondemand.com/attask/api/optask/search?projectID= yourprojectguid &fields=*,parameterValues,project:*,project:parameterValues Regards, Doug