pythonrestrallypyral

Getting error "RallyRESTAPIError: 422 Not authorized to perform action: Invalid key" when trying to create Rally test case


The code below works fine before until I try it today:

...
tc_data = {'Description': 'Test Case Dummy', 'c_QATCPARAMSTEXT': 'GET|/users/$id[1]|||200|{"id":"$id","firstname":"$firstname","lastname":"$lastname","email":"$email","role":"$role"}|||||||DeleteUser;logout|||||login;CreateUser||{"user[email]":"$admin_email","user[password]":"$admin_password"};{"user[email]":"$standard_email","user[firstname]":"$standard_firstname","user[lastname]":"$standard_lastname","user[role]":"$standard_role","user[password]":"$standard_password"}|||||||||||||||||||||||||||||', 'Objective': '', 'LastBuild': '', 'TestFolder': '', 'Type': 'Acceptance', 'Method': 'Automated', 'Expedite': 'false', 'Name': 'Test Case Dummy'}

tc = self.rally.put('TestCase', tc_data)
...

It shows error: "RallyRESTAPIError: 422 Not authorized to perform action: Invalid key" and the test case cannot be created. This is also happening when I try to create a build. However, the GET request works fine as usual.

This seems to happen to developers using java and C# Rally wrapper as well: .Net Rally.RestApi error “Not authorized to perform action: Invalid key” when creating Rally test folder. Please help!


Solution

  • This is a defect and Rally is working to fix it. In the interim, the workaround that is confirmed to have worked for people who originally reported it is to use ApiKey instead of basic (username/password) authentication. Pyral 1.1.1 supports ApiKey. This assumes you are on rally1.rallydev.com, and not on sandbox.rallydev.com. ApiKey is not supported on sandbox.