It's all about the answers!

Ask a question

How to return linked resource properties with REST API or OSLC calls

Masizane Marivate (2317) | asked Mar 25 '18, 4:32 a.m.


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/[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/,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.

Donald Nong commented 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 commented 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.
(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.

Masizane Marivate commented 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 commented 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

2 answers

permanent link
Jim Amsden (27837) | answered Mar 26 '18, 8:33 a.m.

 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.

Masizane Marivate commented Mar 26 '18, 12:57 p.m.

Hi Jim,

I removed the extra header, and only the testscript and the TestResult show their child properties. The test case and testplan only return the uri.

Any further suggestion?

permanent link
Jim Amsden (27837) | answered Mar 26 '18, 1:02 p.m.

 I think you're missing the prefix definitions.

Masizane Marivate commented Mar 26 '18, 1:05 p.m.

Does one still have to include prefix definitions for dcterms:title even if all the other resources have it and return it?

Masizane Marivate commented Mar 27 '18, 6:36 a.m.

I also added the rqm prefix, and still the testplan and test case resource properties are not returned.

I appended : &oslc.prefix=rqm_qm=""

Masizane Marivate commented Mar 28 '18, 4:37 a.m.

on further investigation "" returns a 404 page not found error. perhaps this is the source of the problem?

Your answer

Register or to post your answer.