It's all about the answers!

Ask a question

[closed] How to update/modify multiple test cases in RQM using REST/OSLC?


1
1
Andrew Ciaz (59160) | asked Dec 03 '20, 2:47 a.m.
closed Jun 26 '23, 4:05 a.m. by David Honey (1.8k17)

 Hi team,


I know the REST is support bulk create/update test artifact in RQM. But while updating multiple test cases what should be the Url? 

The documentation is not describe this scenario. Please suggest the solution


Comments
Binoy Udayan commented Jun 23 '23, 5:11 p.m. | edited Jun 26 '23, 4:03 a.m.

I'm writing here as I couldn't comment.

I'm facing a similar issue. I'm trying to update existing test cases, but POST request is creating new test cases instead of updating test cases.

I have tried the following formats for ID
  1. <id>123456<id>
  2. <id>https://<serverurl>/qm/service/com.ibm.rqm.integration.service.IIntegrationService/resources/<project_slug_id>/testcase/<testcase_slug_id></id>
  3. <id>https://<serverurl>/qm/service/com.ibm.rqm.integration.service.IIntegrationService/resources/<project_slug_id>/testcase//urn:com.ibm.rqm:testcase:12345</id>
  4. <id>https://<serverurl>/qm/service/com.ibm.rqm.integration.service.IIntegrationService/resources/<project_name_encoded>/testcase/<testcase_slug_id></id>

All of them created new test cases.

When I tried PUT, getting 400 error resonse with error message 'javax.xml.bind.UnmarshalException: unexpected element (uri:"http://www.w3.org/2005/Atom", local:"feed")'


David Honey commented Jun 26 '23, 4:04 a.m. | edited Jun 26 '23, 5:01 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
Please do not post new questions as answers to old questions that have already been answered. If you want to ask a question, please submit your own new question. I have converted your "answer" to a comment. But please resubmit as a new question. For questions on REST APIs, please include the following information in your question:
  • the request URI
  • the request headers
  • the request body (for PUT/POST)
  • the response headers
  • the response body
Thanks.

The question has been closed for the following reason: "The question is answered, right answer was accepted" by davidhoney Jun 26 '23, 4:05 a.m.

Accepted answer


permanent link
Monika Rajput (25612) | answered Dec 04 '20, 8:21 a.m.

Hi Andrew,


The url and method is correct. The problem is with your body xml. 

As the wiki stated that the body xml should be in format of 
<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
      <entry>
           <id>resource ID</id>
           <content>
                 resource XML
           </content>
       </entry>
</feed>

Something similar to 

<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
<entry>       
<id>https://<server_url>/qm/service/com.ibm.rqm.integration.service.IIntegrationService/resources/<project_name>/testcase/urn:com.ibm.rqm:testcase:2</id>
<content>
<ns19:testcase
xmlns:ns19="http://jazz.net/xmlns/alm/qm/v0.1/"
xmlns:ns3="http://purl.org/dc/elements/1.1/"
xmlns:ns21="http://www.w3.org/1999/XSL/Transform">
<ns3:title type="text">Test updated</ns3:title>
<ns19:weight>500</ns19:weight>
</ns19:testcase>
</content>
</entry>
<entry>
<id>https://<server_url>/qm/service/com.ibm.rqm.integration.service.IIntegrationService/resources/<project_name>/testcase/urn:com.ibm.rqm:testcase:20</id>
<content>
<ns19:testcase
xmlns:ns19="http://jazz.net/xmlns/alm/qm/v0.1/"
xmlns:ns2="http://schema.ibm.com/vega/2008/"
xmlns:ns3="http://purl.org/dc/elements/1.1/"
xmlns:ns21="http://www.w3.org/1999/XSL/Transform">
<ns3:title type="text">Test updated 1</ns3:title>
<ns19:weight>1000</ns19:weight>
</ns19:testcase>
</content>
</entry>
</feed>
Add the proper xmlns for the tags you would like to update i.e. ns3 for updating creator under <ns3:creator>.
You should also add the proper headers. Please go through the wiki for more clarification.

Thanks,
Monika Rajput

Andrew Ciaz selected this answer as the correct answer

Comments
Andrew Ciaz commented Dec 04 '20, 8:32 a.m.

@Monika thanks now the HTTP POST method work correctly but it creates new test cases. My requirement is update test cases in bulk. Is it possible using qm REST API? 


Monika Rajput commented Dec 04 '20, 8:35 a.m.

@Andrew, Please update the ID of each test case to the ID with your existing test case which you would like to update under <id> tag. 


Thanks


Andrew Ciaz commented Dec 04 '20, 10:26 a.m.

and where i should update this <id>  field in my xml or url?

2 other answers



permanent link
Monika Rajput (25612) | answered Dec 04 '20, 4:40 a.m.

Hi Andrew,


The bulk upload is supported on POST requests only. Please see jazz.net wiki Bulk Upload for more information.

Thanks,
Monika Rajput


Comments
Andrew Ciaz commented Dec 04 '20, 7:06 a.m.

Hi @Monika Rajput thanks for your reply when I changed my method to POST, now http response returning 400 code, with PUT it was 302


Andrew Ciaz commented Dec 04 '20, 7:51 a.m.

@Monika Rajput responcebody returns message "No feed entries in the bulk upload request" . could you please help me to understand the meaning m url is:

URL:- https://<serverurl>/qm/service/com.ibm.rqm.integration.service.IIntegrationService/resources/JKE+Banking+%28Quality+Management%29/testcase

Method = POST



permanent link
Andrew Ciaz (59160) | answered Dec 04 '20, 1:00 a.m.

  Hi user PUT method with URL: https://<serverUrl>/qm/service/com.ibm.rqm.integration.service.IIntegrationService/resources/JKE%20Banking%20(Quality%20Management)/testcase/


and below is the xml file:

<?xml version="1.0" encoding="UTF-8"?>
   <title type="text">testcase ATOM feed for project area JKE Banking (Quality Management)</title>
   <link href="https://d-9376:9443/qm/web/console/" rel="alternate" />
   <entry>
      <updated>2020-06-30T15:13:56.679Z</updated>
      <title type="text">Test - Donors Deposit Money Into a Pooled Assistance Fund</title>
      <summary type="text" />
   </entry>
</feed>

It returns 302 response code but test cases is not updated.

Please suggest if i miss something