Jazz Forum Welcome to the Jazz Community Forum Connect and collaborate with IBM Engineering experts and users

RQM 5.0.2 Getting execution result attachements through REST API

I am using REST API for accessing RQM Test Plan details.
Now I need is to get Execution results through REST API. I am able to fetch the details , however it has some screen shots / Images which I am not able to download through my code. It needs browser to download it . Execution result link which through which I would be able to download the attachements / Images through my code.

0 votes



3 answers

Permanent link
Harshal sent me the corrupted PNG file and I noticed that it was tagged with the UTF-8 BOM (the first six byes are EF BF BD 50 4E 47) while the first four bytes of a PNG file should be 89 50 4E 47. So it appears that the tool treats the stream as a string rather than binary. In fact, we can see the message "RQMUrlUtility: Calling [ HTTP GET ] method to retrieve XML from a specified URL" in the command output.

Strictly speaking, the IAttachmentRestService API is an internal API, not RQM Reportable REST API, so we can't expect it to work with any URLs.

Since the source code is included in the tool, we can build the tool with some minor changes so that it can work with the internal attachment URL.
1. Locate the file RQMUrlUtility\src\com\ibm\rqm\url\client\RQMUrlGET.java.
2. Locate this line - it works for the "attachment" resource when using RQM Reportable REST API
        if (sAttachURL.indexOf("attachment") == -1) {
3. Change it as shown below - now it takes care of IAttachmentRestService API as well
        if (sAttachURL.indexOf("attachment") == -1 && sAttachURL.indexOf("IAttachmentRestService") == -1) {
4. Rebuild the tool.

If the tool works correctly, we should see this message in the command output.
RQMUrlUtility: Calling [ HTTP GET ] method to download an attachment

0 votes


Permanent link
I am using the same. the image which we get from it is corrupted or too big .

Below is the command I using
C:\Program Files\Internet Explorer>java.exe -jar C:\Users\IBM_ADMIN\Downloads\RQ
M-Extras-RQMUrlUtil-4.0.3\RQMUrlUtility.jar -command GET -user ckumar45@in.ibm.c
om -password 12345 -filepath C:\\testplan\\testplan.jpg -url "https://rtcclm2:94
43/qm/service/com.ibm.rqm.planning.service.internal.rest.IAttachmentRestService/
_g2unwUzPEeWXOuHUUui6Mw"


0 votes

Comments

Have you tried with the version 5.0.2 of RQM URL Utility?

Yes , I tried same issue I am facing with 5.0.2 .
This is the command execution
C:\Users\IBM_ADMIN\Downloads\RQM-Extras-RQMUrlUtil-5.0.2>java.exe -jar C:\Users\
IBM_ADMIN\Downloads\RQM-Extras-RQMUrlUtil-5.0.2\RQMUrlUtility.jar -command GET -
user ckumar45@in.ibm.com -password 12345 -filepath C:\RQM_Attachment.png -url "
https://rtcclm2:9443/qm/service/com.ibm.rqm.planning.service.internal.rest.IAtta
chmentRestService/_g2unwUzPEeWXOuHUUui6Mw"
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
                                  <<<<<----- [ RQMUrlUtility ] ---->>>>>
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Default cookie policy RFC_2109 is used.
RQMUrlUtility: Connected to https://rtcclm2:9443 using project "cclm2:9443"
Attempting to create SSL_TLS context
java.security.NoSuchAlgorithmException: SSL_TLS SSLContext not available
Unable to create SSL_TLS context, trying SSLv3
RQMUrlUtility: Calling [ HTTP GET ] method to retrieve XML from a specified URL
RQMUrlUtility: Server Response code: 200
RQMUrlUtility: [ SUCCESS ] XML string retrieved from URL : "https://rtcclm2:9443
/qm/service/com.ibm.rqm.planning.service.internal.rest.IAttachmentRestService/_g
2unwUzPEeWXOuHUUui6Mw " is written to file located at -: " C:\RQM_Attachment.pn
g "
Disconnecting from the IBM Rational Quality Manager server.

This is what I am getting when I open the file


You don't have enough reputation to attach a screen shot here. Upload it somewhere else and link back here. Also, have you tried to open the file in a binary editor to see what the content looks like? You may be surprised to see what actually is in the file.


Permanent link
Hi Harshal,

Can you try using the href value of the attachment tag coming as part of ExecutionResult xml

0 votes

Comments

Yes I am using the href value 
which is this in this case



This is what I am getting 
https://rtcclm2:9443/qm/service/com.ibm.rqm.planning.service.internal.rest.IAttachmentRestService/_k1F6wUzPEeWXOuHUUui6Mw

However when I download this using
C:\Program Files\Internet Explorer>java.exe -jar C:\Users\IBM_ADMIN\Downloads\RQ
M-Extras-RQMUrlUtil-4.0.3\RQMUrlUtility.jar -command GET -user ckumar45@in.ibm.c
om -password 12345 -filepath C:\testplan\testplan.jpg -url "https://rtcclm2:94
43/qm/service/com.ibm.rqm.planning.service.internal.rest.IAttachmentRestService/
_g2unwUzPEeWXOuHUUui6Mw"
 

It gives me corrupted file or Big file error

Your answer

Register or log in 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.

Search context
Follow this question

By Email: 

Once you sign in you will be able to subscribe for any updates here.

By RSS:

Answers
Answers and Comments
Question details
× 12,014

Question asked: Sep 07 '15, 4:48 a.m.

Question was seen: 3,753 times

Last updated: Sep 10 '15, 1:11 a.m.

Confirmation Cancel Confirm