VersionOne Web API - How do i get all of the stories/tasks for a given epic?

1.6k Views Asked by At

I am trying to query V1 (from Excel VBA) using the http api client. I can query for a specific epic and get the data from it. e.g.

/rest-1.v1/Data/Epic?sel=Workitem.Number,Epic.AssetType,Name,Status.Name,Swag,Description&where=Workitem.Number='E-01023'

I think i want to use downcast; but that gives me empty data attributes sel=Name,Children:Story&where=Workitem.Number='E-01023'

<Asset href="/mysandbox/rest-1.v1/Data/Epic/2011" id="Epic:2011">
    <Attribute name="Name">Test Item #3</Attribute>
    <Relation name="Children:Story" />
    <Attribute name="Children:Story.Name" />
    <Attribute name="Children:Story.Number" />
</Asset>

I could use SubsAndDown sel=Name,SubsAndDown.Name,SubsAndDown.ID&where=Workitem.Number='E-01023' but i get different rows for each field i want (Id and name).

<Asset href="/mysandbox/rest-1.v1/Data/Epic/2011" id="Epic:2011">
    <Attribute name="Name">Test Item #3</Attribute>
    <Attribute name="SubsAndDown.Name">
        <Value>Story for Test Item #3</Value>
        <Value>mmm mmm mmm</Value>
    </Attribute>
    <Relation name="SubsAndDown.ID">
        <Asset href="/mysandbox/rest-1.v1/Data/Story/2070" idref="Story:2070" />
        <Asset href="/mysandbox/rest-1.v1/Data/Story/2103" idref="Story:2103" />
    </Relation>
    <Attribute name="SubsAndDown.ID.Name">
        <Value>Story for Test Item #3</Value>
        <Value>mmm mmm mmm</Value>
    </Attribute>
    <Attribute name="SubsAndDown.ID.Number">
        <Value>S-01093</Value>
        <Value>S-01098</Value>
    </Attribute>
</Asset>

What i want to get is a data row for each Epic/Story/Task as a flat list to put into excel e.g.

E-01023 | Test Item #3 | Epic<br/>
S-01093 | Story for Test Item #3 | Story<br/>
T-1234  | sample task for story 1093 | Task<br/>
T-1235  | sample task for story 1093 | Task<br/>
S-01098 | mmm mmm mmm | Story<br/>
T-2359  | sample task for story mmmm | Task<br/>
T-2360  | additional task for story mmmm | Task<br/>
T-2361  | final task for story mmmm | Task<br/>
1

There are 1 best solutions below

0
On

I ended up just splitting it into 3 different queries; getting the children for each set.

For Epics: I looped through any Subs.Number that were returned
For Stories: I looped through any Children.Number that were returned which gave me any tasks.

I was surprised that the Parent records / Child records didnt do what i wanted. I was also surprised that the naming convention was different (Subs vs Children); but maybe that is due to the data model.