How can I get a list of all the projects in our Rally instance via the REST API?

蹲街弑〆低调 提交于 2020-01-02 07:05:55

问题


How can I query our Rally instance for all of our available projects?


Output from REST call https://rally1.rallydev.com/slm/webservice/1.29/subscription.js?fetch=Workspaces,Name,Projects&pretty=true

...
"Workspaces":     [
            {
        "_rallyAPIMajor": "1",
        "_rallyAPIMinor": "29",
        "_ref": "https://rally1.rallydev.com/slm/webservice/1.29/workspace/1376977801.js",
        "_objectVersion": "10",
        "_refObjectName": "Workspace 1",
        "Name": "Workspace 1",
        "Projects": [            {
            "_rallyAPIMajor": "1",
            "_rallyAPIMinor": "29",
            "_ref": "https://rally1.rallydev.com/slm/webservice/1.29/project/2510231094.js",
            "_objectVersion": "3",
            "_refObjectName": "Layout",
            "Name": "Layout",
            "_type": "Project"
        }],
        "_type": "Workspace"
    },
            {
        "_rallyAPIMajor": "1",
        "_rallyAPIMinor": "29",
        "_ref": "https://rally1.rallydev.com/slm/webservice/1.29/workspace/1462743357.js",
        "_objectVersion": "8",
        "_refObjectName": "Bugzilla Workspace",
        "Name": "Bugzilla Workspace",
        "Projects": [            {
            "_rallyAPIMajor": "1",
            "_rallyAPIMinor": "29",
            "_ref": "https://rally1.rallydev.com/slm/webservice/1.29/project/2510231094.js",
            "_objectVersion": "3",
            "_refObjectName": "Layout",
            "Name": "Layout",
            "_type": "Project"
        }],
        "_type": "Workspace"
    },

...


Update #2 The user account being used for the API calls is indeed a subscription admin. I tried a few things with our admin to try and narrow down the problem as to what is occurring and noted a few things:

  1. The projects that are getting returned in the call, are not projects that the api user is a team member of
  2. When we assigned a story to the api user and refreshed the result of the REST call, the projects that were returned in every workspace were identical and seemed to be all of the projects from the given workspace of the project that we assigned the story from. For example, I've pasted the top part of a return: http://khayes.privatepaste.com/cfc730dcf8
  3. It appears this particular REST call has a bug in it.

回答1:


This should be possible by querying on type 'Subscription'. Make sure you include Workspaces and Projects (and any other data you might want like Name) in your Fetch.

https://rally1.rallydev.com/slm/webservice/1.29/subscription.js?fetch=Workspaces,Projects,Name&pretty=true

The results should look something like this:

{
    _ref: "/subscription/1.js",
    _refObjectName: "My Subscription",
    Workspaces: [
        _ref: "/workspace/2.js"
        _refObjectName: "My Workspace",
        Projects: [
            {
                _ref: "/project/3.js"
                _refObjectName: "Project 1"
            }
        ]
    ]
}



回答2:


The REST URL would look like this

https://rally1.rallydev.com/slm/webservice/1.29/subscription?fetch=Workspaces,Name,Projects



来源:https://stackoverflow.com/questions/9267370/how-can-i-get-a-list-of-all-the-projects-in-our-rally-instance-via-the-rest-api

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