It's all about the answers!

Ask a question

RQM LabResource REST API - POST example?

Param S (2711) | asked Nov 25 '21, 2:03 a.m.
I need help on 2 points:
1. I am unable to create a lab resource using the RQMUrlUtility. I receive error 400 from RQM server.

Below is my command line on WIndows OS:
java -jar RQMUrlUtility.jar -command POST -user USERNAME -password PASSWORD -url https://MYSERVER:9443/qm/service/ -filepath D:/postpayload.xml

POST Body:

<?xml version="1.0" encoding="UTF-8"?>
<ns2:labresource xmlns:ns2="" xmlns:ns1="" xmlns:ns3="" xmlns:ns4="" xmlns:ns5="" xmlns:ns6="" xmlns:ns7="" xmlns:ns8="" xmlns:ns9="" xmlns:ns10="" xmlns:ns11="" xmlns:ns12="" xmlns:ns13="" xmlns:ns14="" xmlns:ns15="" xmlns:ns16="" xmlns:ns17="" xmlns:ns18="" xmlns:ns20="" xmlns:ns21="">
<ns2:projectArea href="https://MYSERVER:9443/qm/resource/itemOid/" alias="RTC-RQM+POC"/>
<ns2:title>Machine 01</ns2:title>
<ns2:type href="https://MYSERVER:9443/qm/service/">Machine</ns2:type>
<ns2:name>Machine 01</ns2:name>

2. If the lab resource creation succeeds, I also wish to update custom lab resource properties of the created resource via RQM REST API? Is there a possibility to do the same using POST or PUT APIs?

2 answers

permanent link
Ralph Schoon (63.3k33646) | answered Nov 25 '21, 2:33 a.m.

For 1. The request body is missing all the namespace definitions. I do not know a lot about the ETM APIs, but I know the APIs in general good enough to see that ns2 is not defined, nor is xnls or any of the namespaces. I would suggest to try to get an existing resource to understand the data. 

Param S commented Nov 25 '21, 2:38 a.m.
ns2 is defined right after labresource.

I tried using below payload but even this returns error code 400.
<title>Machine 01</title>
<name>Machine 01</name>

Ralph Schoon commented Nov 25 '21, 4:22 a.m.
  1. The editor messes this up and I can't see anything. Consider using Chrome to add a screen shot, or upload the screenshot someplace else and link it to here.

    In any case, if you are trying to send RDF over the line I am pretty sure that this is not proper RDF because it would start with <rdf:RDF  and not with <ns2:labresource.

     2. GET such a resource first and understand the data before even trying to create one.

Param S commented Nov 29 '21, 7:59 a.m. | edited Nov 29 '21, 8:01 a.m.
 I did a GET for a labresource and I got the below:
Thereafter when I POST to create a lab resource with below payload I get error code 400: POST

permanent link
Ralph Schoon (63.3k33646) | answered Nov 29 '21, 9:33 a.m.


I am not an expert with RQM APIs. Here what I can tell.

The API you are using with the RQMURLUtility,  is the RQM Reportable REST API . This API is for reporting and, POST is only supported for some limited use cases. I am not sure if this API is for creation of test resources and if there is a chance to create lab resources with other APIs. 

Maybe you can use OSLC for this, maybe not. I was unable to find an OSLC link for the test resources in the Web UI.

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.