This is a migrated thread and some comments may be shown as answers.

[API] How can I get the Stories which are related to a feature

4 Answers 32 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Steffen
Top achievements
Rank 1
Steffen asked on 10 Feb 2015, 12:29 PM
I created a Feature and wanted to get all stories which are related to this Feature. But I can't get them. I used the RestAPI and the .Net API (which calls the RESTAPI).

My result for workitems (http://localhost:9898/api/v1/workitems) Looks like this:
{"totalResults":3,"top":100,"skip":0,"results":[{"id":4,"type":"Story","projectId":1,"fields":{"AreaID":1,"TeamID":null,"AssignedToID":null,"BacklogPriority":20521207480038.0,"Certainty":null,"Complexity":null,"Description":"","Estimate":2.0,"IterationID":1,"Maturity":null,"Name":"Story2","Priority":null,"PriorityClass":null,"Status":"Not Done","ValueClass":null,"Tags":[],"TfsID":null},"createdBy":"admin","createdAt":"2015-02-10T12:07:48.043Z","lastModifiedBy":"admin","lastModifiedAt":"2015-02-10T12:13:55.747Z"},{"id":3,"type":"Story","projectId":1,"fields":{"AreaID":1,"TeamID":null,"AssignedToID":null,"BacklogPriority":20411520232044.0,"Certainty":null,"Complexity":null,"Description":"","Estimate":3.0,"IterationID":1,"Maturity":null,"Name":"Story1","Priority":null,"PriorityClass":null,"Status":"Not Done","ValueClass":null,"Tags":[],"TfsID":null},"createdBy":"admin","createdAt":"2015-01-30T15:20:23.123Z","lastModifiedBy":"admin","lastModifiedAt":"2015-02-10T12:13:50.41Z"},{"id":2,"type":"Feature","projectId":1,"fields":{"AreaID":1,"TeamID":null,"AssignedToID":null,"BacklogPriority":20411520080574.0,"Description":"","Estimate":null,"IterationID":1,"Name":"Feature1","PriorityClass":null,"Status":"Not Done","Tags":[],"TfsID":null},"createdBy":"admin","createdAt":"2015-01-30T15:20:08.33Z","lastModifiedBy":"admin","lastModifiedAt":"2015-01-30T15:20:08.33Z"}]}

But my results for links (http://localhost:9898/api/v1/links) Looks like this: {"totalResults":0,"top":0,"results":[]}

What am I doing wrong?

4 Answers, 1 is accepted

Sort by
0
Ivan
Telerik team
answered on 11 Feb 2015, 09:08 AM
Hello Steffen,

The Links Api is for the links in the workitems. You could read more about the links here in the Open the story to add links and relationships section.

The Features and the Stories are workitems, so if you want to receive all workitems for a Feature you need to set a filter of your request. The filter should contain the ParentId of the Feature. We are using OData for filtering. Here you can read more about the filtering functionality.

If you have any other questions do not hesitate to contact us.

Regards,
Ivan
Telerik
 
0
Steffen
Top achievements
Rank 1
answered on 16 Feb 2015, 07:13 AM
Ok, I have done filtering with other fields like type.
But I can't see a field like parentId in the fields of a workitem. See above.
0
Accepted
Ivan
Telerik team
answered on 18 Feb 2015, 03:57 PM
Hello Steffen,

I agree with you that parentId is missing in the response for any type different than Task, but you can still include it in your request like this 'api/v1/workitems?$filter=ParentID eq 1'.

With the current implementation, this will work only for parent-child relationships, so you won't be able to select the other relationships. 
If you want this functionality to be extended you can post an item in our Feedback Portal and vote for it. The more votes an item gets, the more likely it will be get implemented sooner.

If you have any other questions, we will be happy to assist you.

Regards,
Ivan
Telerik
 
0
Steffen
Top achievements
Rank 1
answered on 26 Feb 2015, 03:29 PM
Thanks
Tags
General Discussions
Asked by
Steffen
Top achievements
Rank 1
Answers by
Ivan
Telerik team
Steffen
Top achievements
Rank 1
Share this question
or