Can you GET Rally API requirements, defects, and all tasks with one query

瘦欲@ 提交于 2019-12-21 20:46:55

问题


Currently I have to make multiple GETs to 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?


回答1:


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



来源:https://stackoverflow.com/questions/7692692/can-you-get-rally-api-requirements-defects-and-all-tasks-with-one-query

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!