rally

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


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.

Solution

  • 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"
                }
            ]
        ]
    }