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

5 posts, 1 answers
  1. Steffen
    Steffen avatar
    8 posts
    Member since:
    Aug 2011

    Posted 10 Feb 2015 Link to this post

    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?
  2. Ivan
    Admin
    Ivan avatar
    73 posts

    Posted 11 Feb 2015 Link to this post

    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
     
  3. Steffen
    Steffen avatar
    8 posts
    Member since:
    Aug 2011

    Posted 16 Feb 2015 in reply to Ivan Link to this post

    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.
  4. Answer
    Ivan
    Admin
    Ivan avatar
    73 posts

    Posted 18 Feb 2015 Link to this post

    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
     
  5. Steffen
    Steffen avatar
    8 posts
    Member since:
    Aug 2011

    Posted 26 Feb 2015 in reply to Ivan Link to this post

    Thanks
Back to Top