Expand my Community achievements bar.

SOLVED

How to extract task predecessor dependency via API?

Avatar

Level 1

Hi all,

We're working on a piece of software that is supposed to retrieve an object and some of its structure from Workfront using the API, and then create/copy this same structure on a different domain using more API calls.

We are having trouble recreating the exact hierarchy of tasks with predecessors. A more concrete example:

A project has two tasks: Task 1 and Task 2, where Task 1 is the predecessor of Task 2.

In the API explorer the task object has 'predecessors' and 'successors' under the collection tab.

However when querying the API using these fields, the information is not as expected.

Query to API:

https://domain.my.workfront.com/attask/api/v14.0/task/search?fields=predecessors,successors

Query result task 1:

Info from query task 1: {'ID': '123xxxxx', 'name': 'Task 1', 'objCode': 'TASK', 'predecessors': [], 'successors': [{'objCode': 'PRED'}]}

..and query result task 2: {'ID': '123xxxxx', 'name': 'Task 2', 'objCode': 'TASK', 'predecessors': [{'objCode': 'PRED'}], 'successors': []}

As we can see, the predecessors (and successors) field has no ID or any other indication what it's predecessor or successor is.

This makes it hard to figure out which tasks to link together in terms of predecessor and successor.

As far as we can see there are no other fields for Task that give us the needed information.

Maybe we're overlooking some important field or the way we query is incorrect?

Any help in how we could fix this would be greatly appreciated!

Topics

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

API
1 Accepted Solution

Avatar

Correct answer by
Community Advisor

Hi Carlos,

To retrieve all the nested fields under the predecessors and successors collections, you need to append a colon and asterix to the collection reference. So your api call would look like this:

https://domain.my.workfront.com/attask/api/v14.0/task/search?fields=predecessors:*,successors:*

Alternatively you could add the specific nested field your want to retrieve, again using colon syntax:

https://domain.my.workfront.com/attask/api/v14.0/task/search?fields=predecessors:predecessorID,succe...:successorID

Best Regards,

Rich.

View solution in original post

2 Replies

Avatar

Correct answer by
Community Advisor

Hi Carlos,

To retrieve all the nested fields under the predecessors and successors collections, you need to append a colon and asterix to the collection reference. So your api call would look like this:

https://domain.my.workfront.com/attask/api/v14.0/task/search?fields=predecessors:*,successors:*

Alternatively you could add the specific nested field your want to retrieve, again using colon syntax:

https://domain.my.workfront.com/attask/api/v14.0/task/search?fields=predecessors:predecessorID,succe...:successorID

Best Regards,

Rich.

Avatar

Level 1

Hi @Richard Leek‚ ,

Thanks a lot for your help! Much appreciated.

Already working on it with our team. Keep you posted on it! 😉

Regards,

Carlos