Question

I am trying to update a Rally defect in PHP. I have the query - auth - etc parts working. I can find the ObjectID of the defect to edit. I am posting to the url outlined in another question.

Post using 'create' endpoint with the security token appended in the end. In this example 123456789 is the OID of the defect where Description field is being updated

https://rally1.rallydev.com/slm/webservice/v2.0/defect/123456789?key=fbaa0c04-...

The problem is that the result of this POST is the original defect and the defect is not updated. I don't get an error message just no updates take effect. Am I misunderstanding the Post using 'create' endpoint? this only occurs when the key is not supplied on the URL. It seems to act as a GET of the defect.

The problem is with the value of the key parameter. The payload of this call must have only the object JSON. But I can't get past the key validation.

I make the call to get the security token twice to ensure that my curl session is valid and I get the same key. Which is correct. Then I immediately use that key and get an "Invalid Key" response.

Was it helpful?

Solution

The steps below are from a browser REST client, and not specific to PHP.
The assumption is that the security key is already obtained.

To create a defect:

URL:

https://rally1.rallydev.com/slm/webservice/v2.0/Defect/create?key=f8e4afc5-....

Method: POST

Payload:

{
"Defect":{
"Name": "bad defect"
}

To update the same defect:

Browser maintains the session, and as long as the session is not terminated, the same security token can be used.

If the session was terminated ,e.g. due by the user or due to inactivity, a new token must be requested. Below it is assumed that the same token is still valid. Note that the payload has to include only the fields that are being updated, but "Defect" work item type must be specified also.

URL:

https://rally1.rallydev.com/slm/webservice/v2.0/defect/15297487557?key=f8e4afc5-....

Method: POST

Payload:

{"Defect":{
"Description":"pretty bad defect",
"State":"Open",
"Owner":"/user/12361716944"
}
}

The browser maintains the session automatically, and the Ruby, Java or .NET REST toolkits Rally supports also take care of that for the user, but with PHP you need to to do this in your code manually. This post about a cURL example may help.

OTHER TIPS

Remove key= from the url & add the value to the header as zsessionid

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