Jared Russell's Blog

Restoring Deleted Content in Rational Quality Manager

Recently I had an issue where a tester had deleted a number of artifacts from RQM by mistake and wanted to know how to restore them. My first port of call was the jazz.net forums hoping to find that RQM has an un-delete button that I had somehow missed, however I quickly found that this is not the case.

Thankfully the developer that responded in the thread was also kind enough to provide the necessary information to allow you to manually restore records through the REST API:

1
https://server:port/qm/service/com.ibm.rqm.planning.common.service.rest.ITestCaseRestService/archiveTestCases?uuids_versionable=<test_case_uuid>&processArea=<project_uuid>&archive=false

This is certainly a step in the right direction, however it leads to the next obvious question of how do I find the UUIDs of my test cases and project area? My first line of investigation was the OSLC API however this quickly hit a dead-end when I found that it does not return deleted records.

Reportable REST API to the rescue

In the past I’ve used the RQM URL Utility tool to download the content of individual test cases in XML format. This tool is invaluable when you are trying to write a custom configuration file for the RQM Word and Excel importer because it allows you to see the identifiers for custom sections. The examples you see in the URL utility documentation are all based on the RQM Reportable REST API which provides a means of both listing and viewing individual records within RQM.

Looking through the documentation I was able to find the solution to seeing the deleted records: the includeArchived query parameter. Performing a GET on the test case feed URI with this parameter set to true I was able to get an XML response that contained all of the test cases in my RQM project area, both active and deleted. The last remaining issue was to get the UUID of each of the test records, which is also catered for in the API via the metadata query parameter.

All of this leads you to a query shape of:

1
https://server:port/qm/service/com.ibm.rqm.integration.service.IIntegrationService/resources/<project-alias>/<resource-type>

Performing a GET on the above URL leads to a result-set that contains entries similar to the following:

1
2
3
4
5
6
7
<entry xmlns="http://www.w3.org/2005/Atom">
 <id>_KSwzJeLrEeGnZrjoVKQNBw</id>
 <title type="text">My Test Case</title>
 <summary type="text"/>
 <updated>2012-08-13T13:52:08.259Z</updated>
 ...
</entry>

The UUID of the test case is the value of the id element.

The last remaining step is to find the UUID of the project the records are part of.  I’ve found that the easiest way to obtain this is to simply open the “Manage This Project Area” page within RQM, then get the UUID from the itemId query parameter.

Putting it all together

Now that we have both the UUID of the test case and the project area we can replace the values in the URL I mentioned at the start of the article and perform an HTTP POST to restore the test cases on the server. To perform a POST you can either use a command line utility such as cURL or a tool such as the Firefox Poster addon. Below is an example of the cURL command to use:

1
curl -X POST https://rqmserver:9443/qm/service/com.ibm.rqm.planning.common.service.rest.ITestCaseRestService/archiveTestCases?uuids_versionable=_KSwzJeLrEeGnZrjoVKQNBw&processArea=_W1iVMBuDEdy4euo1O8SrOg&archive=false

Overall this is quite a complicated process for an operation that should really only take a couple of clicks through the user interface. Hopefully this article will help someone avoid either having to manually re-type a bunch of information or worse, restoring their database from a backup. With any luck IBM will plan this functionality in for a release sometime soon, however after being open for 15 months at the time of writing this, I feel it’s already long overdue.

Update 29/08/13: As of version 4.0.3 RQM now has the capability to restore deleted content (as well as permanently deleting records). For users of prior versions you will still need to use the steps I’ve documented above.