Querying Milestones and their RevisionHistory by Project in WS API

Document ID : KB000057533
Last Modified Date : 14/02/2018
Show Technical Document Details

Issue

Unlike queries on other timeboxes, such as Release and Iteration, Milestone revision queries cannot be scoped using project query parameter.

Resolution

1. MIlestone by Project:

A Milestone object does not have a?Project?attribute. It has a?Projects?attribute, which is a reference to a collection, and a?TargetProject?attribute
Here is a result returned by an endpoint:
https://rally1.rallydev.com/slm/webservice/v2.0/milestone?workspace=https://rally1.rallydev.com/slm/webservice/v2.0/workspace/12352608129&query=(FormattedID = MI1)&fetch=true

User-added image

Notice the TargetProject's ObjectID:?16662089077. If we construct the endpoint with the project query parameter instead of the workspace query parameter as follows:

https://rally1.rallydev.com/slm/webservice/v2.0/milestone?project=https://rally1.rallydev.com/slm/webservice/v2.0/project/16662089077&query=(FormattedID = MI1)&fetch=true

It returns the same json as the endpoint with workspace parameter, which indicates that the project query parameter can be used with a Milestone query. The project query parameter here is not being simply ignored - it actually works. It's been tested by running this query in the browser's Incognito mode, while testing a milestone with a TargetProject that is?not?a default project of the current user (while also not being logged in to that project in another tab of the same browser window).

Note that using project query parameter and querying by?Project?attribute is not the same thing. Hitting this endpoint

https://rally1.rallydev.com/slm/webservice/v2.0/milestone?workspace=https://rally1.rallydev.com/slm/webservice/v2.0/workspace/12352608129&query=(Project.ObjectID = 16662089077)&fetch=true

will fail return:

"Could not read: could not read all instances of class com.f4tech.slm.domain.Milestone"

because there is no?Project?field on a Milestone.?

To correct it?TargetProject?should be used instead:

https://rally1.rallydev.com/slm/webservice/v2.0/milestone?workspace=https://rally1.rallydev.com/slm/webservice/v2.0/workspace/12352608129&query=(TargetProject.ObjectID = 16662089077)&fetch=true

Conclusions:
a) Milestone query can use project query parameter (it uses TargetProject value)
b) Milestones cannot be queried by?Project?attribute since there is no such attribute on Milestone.
The outcome of (a) may be confusing when the same behavior is expected when using Project attribute on a Milestone or when querying for RevisionHistory of milestones with project query parameter (see #2 below).

2. Milestone RevisionHistory by Project

Unlike the RevisionHistory of other timbox types, Release and Iteration, RevisionHistory of Milestones cannot be queried with project query parameter.

Let's say we have a release in workspace?12352608129?and project?16662089077, and the reference to RevisionHistory of this release:?/revisionhistory/35207573393

and we have a? milestone in the same workspace?12352608129?and project?16662089077, and the reference to RevisionHistory of this milestone:?/revisionhistory/33215216899

Endpoint examples below return Revisions for the same release. Project query parameter works with Revision endpoint for release:

https://rally1.rallydev.com/slm/webservice/v2.0/revision?project=https://rally1.rallydev.com/slm/webservice/v2.0/project/16662089077&query=(RevisionHistory = /revisionhistory/35207573393)&fetch=true&start=1&pagesize=200

https://rally1.rallydev.com/slm/webservice/v2.0/revision?workspace=https://rally1.rallydev.com/slm/webservice/v2.0/workspace/12352608129&query=(RevisionHistory = /revisionhistory/35207573393)&fetch=true&start=1&pagesize=200


Project query parameter does not work with Revision endpont for milestone.
This endpoint returns 0 results:

https://rally1.rallydev.com/slm/webservice/v2.0/revision?project=https://rally1.rallydev.com/slm/webservice/v2.0/project/16662089077&query=(RevisionHistory = /revisionhistory/33215216899)&fetch=true&start=1&pagesize=200

User-added image

while this endpoint returns Revisions of the milestone as expected:

https://rally1.rallydev.com/slm/webservice/v2.0/revision?workspace=https://rally1.rallydev.com/slm/webservice/v2.0/workspace/12352608129&query=(RevisionHistory = /revisionhistory/33215216899)&fetch=true&start=1&pagesize=200

User-added image
?