Agile Central - Queries: How to query a milestone's work items using WSAPI
Document ID :
Last Modified Date :
Show Technical Document Details
CA Agile Central
AGILE CENTRAL SAAS:ACSAAS
How can WSAPI be used to return the work items (for example, user stories) of a milestone and in-general to explore the Milestone <-> Work Item relationship ?
Let's use User Stories as an example:
The relationship between Milestones and User Stories is stored on both end points. Hence, there are a couple of ways you can go about exploring it:
1. Use the HierarchicalRequirement endpoint.
2. Use the Milestone endpoint.
Using the HierarchicalRequirement
Below is an example of a query that is going to return all user stories which have a milestone and also that the milestone’s name is “milestone_2”. The first part of the query is ensuring there is a milestone that’s linked with the user story. The second part is filtering by the name of the milestone.
Using the Milestone
The Artifacts field is the one that has all the artifacts linked to that milestone. In order to find milestones that have any artifact (in other words , to exclude those which don’t) then you can use (Artifacts.ObjectID > 0).
You should call the Artifacts collection such as in:
The above query returns the count of the Artifacts of that Milestone, in this case: 4.
To further know which are User Stories out of these 4 you will need to look into both the
of each of the collection's objects. The
field will have "Hierarchical Requirement" when the object is a User Story. The
will have an object id of the Hierarchical Requirement endpoint. Here is an example of one of the Artifacts collection objects:
Similarly, you can leverage the same process to query any work item type.
How to query Milestones by Artifacts and Artifacts by Milestones
Querying Milestones and their RevisionHistory by Project in WS API
How to search for a Milestone using the WebServices API In Agile Central
Was this information helpful?