It's all about the answers!

Ask a question

RQM REST API - PUT Request


Liora Milbaum (513289118) | asked Oct 28 '14, 12:27 p.m.
 CLM 5.0.1

We used to work in CLM 4.0.4 with the RQMUrlUtility to update Test Results (GET+PUT).
Recently, we have upgrade to CLM 5.0.1. The PUT command is broken. We receive error 400 as stated in https://jazz.net/wiki/bin/view/Main/RqmApi#PUT_requests.

We do not have an external ID.  So PUT is no longer usable for us. POST command is also not usable as we want to update test result, not to create a new one. 

Please advice,
Liora

Comments
Donald Nong commented Oct 28 '14, 7:51 p.m. | edited Oct 28 '14, 7:54 p.m.

Can you please be more specific how you use the PUT method? I can use PUT against the resource URI to update attributes of a test artifacts without any errors. For example, below is the response body, along with HTTP 200 code, that I get when updating the title of a test case result.

<entry xmlns:rqm="http://schema.ibm.com/rqm/2007#executionresult" xmlns="http://www.w3.org/2005/Atom" >
    <rqm:resultId xmlns:rqm="http://schema.ibm.com/rqm/2007#executionresult" >71</rqm:resultId >
    <rqm:resultItemId xmlns:rqm="http://schema.ibm.com/rqm/2007#executionresult" >_445_sERlEeSsYsRLqtyMDg</rqm:resultItemId >
    <rqm:resultExternalId xmlns:rqm="http://schema.ibm.com/rqm/2007#executionresult" >urn:com.ibm.rqm:executionresult:71</rqm:resultExternalId >
</entry >
P.S. Testing done with RQM 5.0.1.


Liora Milbaum commented Oct 28 '14, 10:05 p.m.

 Well, I am receiving the XML representation of the Test Result with the GET command, updating the XML file (changing the state from one state to another) and than issuing a PUT command with this XML.


As I mentioned, all is done using RQMUrlUtility.

I have looked at your sample and it has the rqm:resultExternalId tag. The XML I have doesn't have this tag.


Donald Nong commented Oct 28 '14, 11:06 p.m. | edited Oct 28 '14, 11:07 p.m.

The <rqm:resultExternalId> is only in the response body, not in the request that I sent. The payload only contains <rqm:title> in my test. Also I was using a REST client to do the test, not RQMUrlUtility.
Umh...when I think about it, is it because you upgraded from 4.0.4 to 5.0.1 and I have a brand new 5.0.1 environment?

2 answers



permanent link
Paul Slauenwhite (8.4k12) | answered Oct 29 '14, 6:22 a.m.
FORUM MODERATOR / JAZZ DEVELOPER
Hi Liora,

Please try using the HTTPRequester/Poster Firefox plug-ins.  Also, what is the response content with the 400 (Bad Request) response?  See https://jazz.net/wiki/bin/view/Main/RqmApi#Troubleshooting for more details.

Comments
Liora Milbaum commented Nov 02 '14, 8:20 a.m.

Hi Paul,


Your suggestion helped a lot. I've looked at the log. It was a license issue. Fixed it.
BUT, I hit another issue. I extracted the XML file with the GET command, updated the XML file and tried to update the resource with the PUT command. 
The PUT command fails with error 412. The log file states that I am running the command with user - 'jennyt'. I issue the PUT command with user 'builder'. 

Please advice,
Liora


Donald Nong commented Nov 02 '14, 7:19 p.m.

If you are using Firefox, bear in mind that there can be only one user actively connected to CLM. You need to log out a user before logging in as another user.


Liora Milbaum commented Nov 02 '14, 11:43 p.m.

Donald, I am using RQMUrlUtility. The user credentials are provided as arguments.

 


Paul Slauenwhite commented Nov 03 '14, 10:45 a.m.
FORUM MODERATOR / JAZZ DEVELOPER

Liora, the 412 (Precondition Failed) response code indicates something is missing in the PUT request.  Can you try using the HttpRequester/Poster Firefox plug-in and post the response content?


Liora Milbaum commented Nov 04 '14, 5:29 a.m. | edited Nov 04 '14, 5:29 a.m.

Paul, tried using the HttpRequester/Poster Firefox plug-in. I am trying to figure out how to work with it. 


permanent link
Liora Milbaum (513289118) | answered Nov 04 '14, 7:18 a.m.
 Paul, I didn't figure out how to use Ff as you suggested.
What I have done was to change the logger settings to DEBUG and than run the RQMUrlUtility with the PUT command again. This is what I have found in the qm.log file:

58627 2014-11-04 14:00:57,682 [http-bio-9443-exec-233 @@ 14:00 LMB /qm/service/com.ibm.rqm.integration.service.IIntegrationService/resources/JKE+Banking+(Q        uality+Management)/executionresult/urn:com.ibm.rqm:executionresult:47] DEBUG repository.service.internal.rdb.TransactionalCache  - Returning VALID re        port for entry status. The cache entry was: CacheEntry[key='com.ibm.rqm.deployment.model.impl.BucketLockHandleImpl@70e570e5 (stateId: [UUID _4YcX8GQX        EeSeoaOdcVHt2Q], itemId: [UUID _4YRY0GQXEeSeoaOdcVHt2Q], origin: null, immutable: <unset>)';uuid=_Nzlq62QYEeSeoaOdcVHt2Q;futureValue=FVReference[key=        com.ibm.rqm.deployment.model.impl.BucketLockHandleImpl@70e570e5 (stateId: [UUID _4YcX8GQXEeSeoaOdcVHt2Q], itemId: [UUID _4YRY0GQXEeSeoaOdcVHt2Q], ori        gin: null, immutable: <unset>);mayHaveAFuture=true;isEnqueued=false;ref=com.ibm.rqm.deployment.model.impl.BucketLockImpl@6ff66ff6 (stateId: [UUID _4Y        cX8GQXEeSeoaOdcVHt2Q], itemId: [UUID _4YRY0GQXEeSeoaOdcVHt2Q], origin: <unset>, immutable: true) (contextId: [UUID _8lNyYNwSEd2pIJ5QVwgQGg], modified        : 2014-11-04 13:44:07.896, workingCopy: false) (predecessor: <unset>) (artifact: executionresult, bucket: 8)];extraInfo=412;head->null]
 

Comments
Paul Slauenwhite commented Nov 04 '14, 10:00 a.m.
FORUM MODERATOR / JAZZ DEVELOPER

Liora, this DEBUG log message does not indicate the cause of the 412 (Precondition Failed) response code.  You need to capture the response content to resolve the reason.  Please follow the instructions in https://jazz.net/wiki/bin/view/Main/RQMUsingPoster to use Poster.


Liora Milbaum commented Nov 04 '14, 11:32 a.m.

I have followed the instructions and succeed working with Poster.


This is the error I get during the PUT:
Error 403: The user has the roles required to perform this operation, but the permission has been denied because this request might have been forged by a malicous website. To prove that this request is not part of a CSRF attack add a new HTTP header with the name &amp;#x27&#59;X-Jazz-CSRF-Prevent&amp;#x27&#59; and use the current JSESSIONID value as the value.


Liora Milbaum commented Nov 04 '14, 11:41 a.m.

 I have added the header and it worked. It doesn't work with the RQMUrlUtility.


1
Paul Slauenwhite commented Nov 04 '14, 12:13 p.m.
FORUM MODERATOR / JAZZ DEVELOPER

Please open a RQM defect and we will fix the RQM URL Utility.


Your answer


Register or to post your answer.


Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.