Question

We have created and closed a large number of Projects in Rally over the years. Because you can't actually delete Projects entirely, I've found the need to re-open the closed Projects, modify some artifacts, and reclose the project. A simple example of what I'm trying to do is reflected in this bit of Python:

resp = session.get('https://rally1.rallydev.com/slm/webservice/v2.0/project/' + ObjectID, auth=HTTPBasicAuth(user, password))
state = resp.json()["Project"]["State"]
if state == "Closed":
    info = { "State": "Open" }
    resp = session.post('https://rally1.rallydev.com/slm/webservice/v2.0/project/' + ObjectID + '?key=' + token, auth=HTTPBasicAuth(user, password), data=json.dumps(info))
    print resp.content

So if a project's "State" is "Closed", POST a JSON object to the API URL of the Project setting it to "Open".

It doesn't work. I get this response:

{
    "OperationResult": {
        "Errors": [
            "Cannot set attribute on a com.rallydev.webservice.json.JSONSingleProperty"
        ],
        "Warnings": [],
        "_rallyAPIMajor": "2",
        "_rallyAPIMinor": "0"
    }
}

Is there another way to open/close a Project via the Rally WS API?

Was it helpful?

Solution

There may be two issues.

First, there was a performance optimization made a couple of years ago that limited queries to open projects. At this point, the only way to get a list of closed projects is on the Projects page for a given workspace, in the UI. When we query for projects, WS API returns only open projects. Try without checking for this condition state == "Closed"

However as long as the project endpoint is accessed directly, it should be possible to reopen a project. I did not try it with Python, but using a browser REST Client I re-opened a project as follows:

a) got security token from security endpoint:

https://rally1.rallydev.com/slm/webservice/v2.0/security/authorize

b) appended the token to the request:

Endpoint:

https://rally1.rallydev.com/slm/webservice/v2.0/project/14304671845?key=b2c8aa01-...

Payload:

{"Project":{
"State":"Open"
}}

This works.

Second, security token has to be appended to the post request, but it is not enough. Please make sure that you maintain the session cookie, since unlike the scenario in the browser REST client, where the browser maintains the session automatically, in your scenario this is not the case. See this StackOverflow post.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top