It's all about the answers!

Ask a question

RQM LabResource REST API - POST example?


Param S (275) | asked Nov 25, 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/com.ibm.rqm.integration.service.IIntegrationService/resources/RTC-RQM+POC/labresource -filepath D:/postpayload.xml


POST Body:

<?xml version="1.0" encoding="UTF-8"?>
<ns2:labresource xmlns:ns2="http://jazz.net/xmlns/alm/qm/v0.1/" xmlns:ns1="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:ns3="http://schema.ibm.com/vega/2008/" xmlns:ns4="http://purl.org/dc/elements/1.1/" xmlns:ns5="http://jazz.net/xmlns/prod/jazz/process/0.6/" xmlns:ns6="http://jazz.net/xmlns/alm/v0.1/" xmlns:ns7="http://purl.org/dc/terms/" xmlns:ns8="http://jazz.net/xmlns/alm/qm/v0.1/testscript/v0.1/" xmlns:ns9="http://jazz.net/xmlns/alm/qm/v0.1/executionworkitem/v0.1" xmlns:ns10="http://open-services.net/ns/core#" xmlns:ns11="http://open-services.net/ns/qm#" xmlns:ns12="http://jazz.net/xmlns/prod/jazz/rqm/process/1.0/" xmlns:ns13="http://www.w3.org/2002/07/owl#" xmlns:ns14="http://jazz.net/xmlns/alm/qm/qmadapter/v0.1" xmlns:ns15="http://jazz.net/xmlns/alm/qm/qmadapter/task/v0.1" xmlns:ns16="http://jazz.net/xmlns/alm/qm/v0.1/executionresult/v0.1" xmlns:ns17="http://jazz.net/xmlns/alm/qm/v0.1/catalog/v0.1" xmlns:ns18="http://jazz.net/xmlns/alm/qm/v0.1/tsl/v0.1/" xmlns:ns20="http://jazz.net/xmlns/alm/qm/styleinfo/v0.1/" xmlns:ns21="http://www.w3.org/1999/XSL/Transform">
<ns2:projectArea href="https://MYSERVER:9443/qm/resource/itemOid/com.ibm.team.process.ProjectArea/425qgE1BEeydlfZ-2g8gA" alias="RTC-RQM+POC"/>
<ns2:title>Machine 01</ns2:title>
<ns2:type href="https://MYSERVER:9443/qm/service/com.ibm.rqm.integration.service.IIntegrationService/resources/RTC-RQM+POC/labresourceattribute/Machine">Machine</ns2:type>
<ns2:name>Machine 01</ns2:name>
</ns2:labresource>

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 (59.4k23642) | answered Nov 25, 2:33 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

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. 


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

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

Ralph Schoon commented Nov 25, 4:22 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
  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 yesterday | edited yesterday
 I did a GET for a labresource and I got the below:
GET SINGLE RESOURCE RESPONSE
Thereafter when I POST to create a lab resource with below payload I get error code 400: POST



permanent link
Ralph Schoon (59.4k23642) | answered yesterday
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

 

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 https://jazz.net/wiki/bin/view/Main/RqmApi . 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.