Querying Milestones and their RevisionHistory by Project in WS API
search cancel

Querying Milestones and their RevisionHistory by Project in WS API

book

Article ID: 57533

calendar_today

Updated On:

Products

Rally On-Premise Rally SaaS

Issue/Introduction

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/<Workspace_OID>&query=(FormattedID = MI1)&fetch=true

Notice the TargetProject's ObjectID. 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/<Project_OID>&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/<Workspace_OID>&query=(Project.ObjectID = <Project_OID>)&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/<Workspace_OID>&query=(TargetProject.ObjectID = <Project_OID>)&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 <Workspace_OID> and project <Project_OID>, and the reference to RevisionHistory of this release: /revisionhistory/<Object_OID>

and we have a milestone in the same workspace <Workspace_OID> and project <Project_OID>, and the reference to RevisionHistory of this milestone: /revisionhistory/<Object_OID>

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/<Project_OID>&query=(RevisionHistory = /revisionhistory/<Object_OID>)&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/<Workspace_OID>&query=(RevisionHistory = /revisionhistory/<Object_OID>)&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/<Project_OID>&query=(RevisionHistory = /revisionhistory/<Object_OID>)&fetch=true&start=1&pagesize=200

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/<Workspace_OID>&query=(RevisionHistory = /revisionhistory/<Object_OID>)&fetch=true&start=1&pagesize=200