Currently I have to make multiple GETs 开发者_如何学Pythonto receive all the information which I need
- User Story: FormattedID, _refObjectName, State, Owner._refObjectName
- Tasks for each User Story: FormattedID, _refObjectName, State, Owner._refObjectName
- Defect: FormattedID, _refObjectName, State, Owner._refObjectName
- Tasks for each Defect: FormattedID, _refObjectName, State, Owner._refObjectName
For all of the User Stories I use:
https://rally1.rallydev.com/slm/webservice/1.26/hierarchicalrequirement.js?query=((Project.Name = "[projectName]") and (Iteration.Name = "[iterationName]"))&fetch=true&start=1&pagesize=100
For all of the Defects I use:
https://rally1.rallydev.com/slm/webservice/1.26/defects.js?query=((Project.Name = "[projectName]") and (Iteration.Name = "[iterationName]"))&fetch=true&start=1&pagesize=100
Within each of these, if they have any Tasks, they display as:
{
"_rallyAPIMajor": "1",
"_rallyAPIMinor": "26",
"_ref": "https://rally1.rallydev.com/slm/webservice/1.26/task/9872916743.js",
"_refObjectName": "Update XYZ when ABC",
"_type": "Task"
}
This doesn't have all the information I need, so I hit each of the Tasks' _ref URLs to get the full task information.
This adds up to sometimes 80+ AJAX calls per page load.
Is there a better query which would provide the extra Task information up front?
The fetch parameter can be tricky with queries. If you provide fetch=true
you will get all of the fields that exist on the queried type (Story,Defect). If the field is also a domain object (like a tasks or a defect) you will only get the thin ref object like this
{
"_ref": "/task/1234.js"
}
If you want to get fields populated on the sub-objects you will need to specify the fields you want shown in the fetch param fetch=Name,FormattedID,Tasks
. This would return an object like the one below:
{
"HierarchicalRequirement" : {
"Name" : "StoryName",
"FormattedID" : "S1234",
"Tasks" : [
{
"_rallyAPIMajor": "1",
"_rallyAPIMinor": "26",
"_ref": "https://rally1.rallydev.com/slm/webservice/1.26/task/9872916743.js",
"_refObjectName": "Update XYZ when ABC",
"_type": "Task",
"FormattedID" : "T1",
"Name" : "Update XYZ when ABC"
}
]
}
}
Let me know if that helped
精彩评论