WorkFront / AtTask API querying secondary objects

880 views Asked by At

I'm using the WorkFront / AtTask API and when looking up Tasks, I'd like to filter them down to the Projects that contain specific Roles.

using /TASK/search/?fields=project:roles it will show me the Roles, but then I'm not sure how to filter on those.

  • Accessing a tertiary object directly (fails)

I tried /TASK/search/?project:roles:ID=aaaaaaa but the API returns (422) Unprocessable Entity.

  • Access from the parent object (works)

task -> project -> /PROJ/search/?roles:ID=aaaaaaa works, but involves sub-queries to the API that are costly and slow.

  • Access from secondary object's ID fields (works)

/TASK/search/?project:ownerID=bbbbbbb since it references a field of a secondary object and not yet another object. But I've only been able to make this work with single-instance references and don't know how to access the ID fields of collections without referencing them as objects.


So how could I filter or access down to a secondary object's collection? I can view them in a single API query, but can't seem to filter.

Task > It's Project > filter by Role

2

There are 2 answers

0
Zorgarath On

The best solution I can think of thus far is:

  1. Pull the list of acceptable projects based on role.

    • /PROJ/search/?roles:ID=aaaaaa&...
  2. Save the list of projects in memory

  3. Pull the list of Tasks in question
    • /TASK/search/?...
  4. Remove the tasks that don't have a project ID from step 2

This way it's only 2 queries and the project query should have a minimal impact in terms of size and number of entries.

0
Brian R On

This functionality is not available in Workfront, neither through the API nor through built-in tools like Reports. This is due to a constraint on the database side of things. After seeing this question I spoke with my enterprise support team at Workfront and received confirmation of this from the DBAs.

The solution that you provided is the best you can do - split this query into the front and back half of your parameters and filter results within your code.