1

I would like to get the story name and number from querying tasks by owner. I am wondering if this is possible in a single query or if I will have to first query for the specific task and then look up the story using the task identifier in two separate queries.

Input: Task.Owners.Name

Output: Story.Name,Story.Number

Task Attributes

*Owners.Name

*TaskID

Story Attributes

*TaskID

*Name

*Number

I am able to call the REST api like below:

rest-1.v1/Data/Task?where=Task.Owners.Name='{{ownerName}}'&sel=Task.Owners.Name,Task.Number,Parent

Is there a way to query the Story endpoint with only task attributes specified in the where condition?

HedonicHedgehog
  • 592
  • 1
  • 6
  • 17

1 Answers1

2

Is there a way to query the Story endpoint with only task attributes specified in the where condition?

I am starting from the Story endpoint, iterating through all Stories filtering by the Tasks that belong to the current Story, and filtering by the Task's Owners attribute.

 /rest-1.v1/Data/Story?sel=Number,Children:Task[Owners.Name='pinky']&where=Children:Task[Owners.Name='pinky']

(1) sel=Children:Task[Owners.Name='pinky']- The Children multi-relation returns all children of a Story which are Tests and Tasks. I used downcasting to filter down to only Tasks.

(2) Inside of the [ ], is where you can add a specific filter to the data return from Children:Task.

(3) @where=Children:Task[Owners.Name='pinky'] is a way to filter out items that have empty elements. Experiment with it by removing it and see the difference in output.

Mark Irvin
  • 830
  • 1
  • 6
  • 16