How to return linked resource properties with REST API or OSLC calls
Hi,
What am I doing wrong in either one of these calls:
curl -X GET -k -H 'Content-Type: application/rdf+xml' -H 'OSLC-Core-Version: 2.0' -H 'Accept: application/xml' -i '.../qm/service/com.ibm.rqm.integration.service.IIntegrationService/resources/_yG3bADHBEeWfYafF4ht9rQ/executionworkitem?fields=feed/entry/content/executionworkitem[title='\''X 602_1'\'']/(identifier|testplan/(webId/title)|testcase/state|testscript/(webId|state)|currentexecutionresult/verdict)&wildcard=X'
curl -X GET -k -H 'Content-Type: application/rdf+xml' -H 'OSLC-Core-Version: 2.0' -H 'Accept: application/xml' -i '.../qm/oslc_qm/contexts/_yG3bADHBEeWfYafF4ht9rQ/resource/com.ibm.rqm.execution.TestcaseExecutionRecord?oslc.properties=dcterms:identifier,oslc_qm:runsTestCase{oslc:shortId,dcterms:title,rqm_process:hasWorkflowState},oslc_qm:reportsOnTestPlan{oslc:shortId,dcterms:title},oslc_qm:executesTestScript{oslc:shortId,rqm_process:hasWorkflowState},rqm_qm:currentTestResult{rqm_qm:verdict}'
I'm expecting the response to contain the properties of the testplan, testcase and testcript. instead all i get is the uri of each resource.
I've been over the documentation in the wiki and still can't figure out what I'm doing wrong.
2 answers
You're using application/rdf+xml in the Content-Type for a GET. It should be Accept: application/rdf+xml and no Content-Type. GET does not have an entity request body.
I think you're missing the prefix definitions.
Comments
Does one still have to include prefix definitions for dcterms:title even if all the other resources have it and return it?
I also added the rqm prefix, and still the testplan and test case resource properties are not returned.
I appended : &oslc.prefix=rqm_qm="http://jazz.net/ns/qm/rqm#"
on further investigation "http://jazz.net/ns/qm/rqm#" returns a 404 page not found error. perhaps this is the source of the problem?
Comments
Donald Nong
Mar 29 '18, 5:22 a.m.I can see the same symptom, and will give you more details if I can figure it out.
Donald Nong
Mar 29 '18, 6:09 a.m.If I read the document correctly, only two artifact types will give you the embedded referenced resource properties, with limitation.
https://jazz.net/wiki/bin/view/Main/RqmApi#Embedded_referenced_resource_pro
(but I can't get it to work for the two types mentioned in the document)
The OSLC API lacks behind in terms of implementation compared to the REST API, and I doubt that it provide such capability either.
https://jazz.net/wiki/bin/view/Main/RqmOslcQmV2Api
1 vote
Masizane Marivate
Mar 31 '18, 5:46 a.m.Hi Donald,
My queries, either RTP or OSLC, are looking up testcase/testscript/testplan and execution results, of which only the last one is not listed as a primitive property. Further still i'm initially only trying to get simple embedded info, like title/and shortId(webId). I've followed the documentation examples and guidelines however it doesn't seem to be working as expected.
Masizane Marivate
Mar 31 '18, 5:47 a.m.Also.. I have surprisingly gotten further with OSLC than I have with REST API:
Masizane Marivate
Mar 31 '18, 5:53 a.m.you must change header to:
accept: "application/atom+xml
this will return nested properties for testscript and testexecutionresult. however the testplan and testcase properties are not nested.
If you search for the execution result and requested nested properties for the testcase, tesplan, testscript,testexecution record, weirdly enough testcase and testplan nested properties are returned but testscript and testexecution record are not returned