4
votes

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.
3

3 Answers

2
votes

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"
            }
        ]
    ]
}
0
votes

I tried in postman with basic authentication: username and password of rally: All APIs are inter related : let us see step by step and always notice the _ref in your response.

Step 1: First you want the subscription.

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

It will return subscription ID suppose it is X.

Step 2: Find the workspaces in that subscription. Put X value as subscription shown below.

https://rally1.rallydev.com/slm/webservice/v2.0/Subscription/X/Workspaces

It will return the workspace id. Let us say it Y.

Step 3: Find the projects in the workspace.

https://rally1.rallydev.com/slm/webservice/v2.0/Workspace/Y/Projects?fetch=ObjectID

There will be URLs in the response which refers to your projects associated to your workspace.

OR,

if you know your workspace ID then use below api: your_WS_id= your workspace ID in below request. just replace this.

https://rally1.rallydev.com/slm/webservice/v2.0/Workspace/your_WS_ID/Projects?fetch=Name

I hope it helps.