It's all about the answers!

Ask a question

Is it possible to search for an RRC artifact via REST API using the artifact ID as a parameter?


Andrew Trobec (49713144139) | asked Jan 29 '14, 7:30 a.m.
edited Jan 29 '14, 8:15 a.m.
Hello,
 
I am using RRC 4.0.0.1 and I am trying to search for an artifact via REST API based on it's ID.  This is because the artifacts are referenced by their UUID (for example https://server.com/rm/resources/_vvjWoMz8EeKAvJ3otSDu6Q) and not by their IDs like in RTC.

I would like to pass the ID, find the corresponding UUID and then access the artifact by constructing the URL.  Is this possible?  Are there any other ways of achieving this?

Thank you in advance,

Andrew

edit:  I can construct a query 

https://server.com/rm/views?oslc.query=true&projectURL=https://server.com/jts/process/project-areas/_TIhVZLhvEeKto8qW7nvWBw&oslc.prefix=dcterms=<http://purl.org/dc/terms/>&oslc.select=*&oslc.where=dcterms:identifier=35

that searches a project area for an artifact with ID 35, but it returns an error:

    <rdf:RDF
    xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
    xmlns:err="http://jazz.net/xmlns/prod/jazz/foundation/1.0/">
    <rdf:Description>
    <err:detailedMessage rdf:datatype="http://www.w3.org/2001/XMLSchema#string"
    >getInternalRequestHandlerService(context) returned null. This error used to report 'The requested service requires a private header'. (More info found at entry [57f572ea2e6010e5] in RRS server log)</err:detailedMessage>
    <err:errorMessage rdf:datatype="http://www.w3.org/2001/XMLSchema#string"
    >Forbidden</err:errorMessage>
    <err:errorStatus rdf:datatype="http://www.w3.org/2001/XMLSchema#long"
    >403</err:errorStatus>
    </rdf:Description>
    </rdf:RDF>

Any ideas?

Accepted answer


permanent link
Gabriel Ruelas (1.1k13) | answered Jan 29 '14, 10:15 a.m.
Hi,
   That query should work, ensure that you are using the proper OSLC Headers. PLS check for smaples at : https://jazz.net/library/article/1197
Ralph Schoon selected this answer as the correct answer

Comments
Andrew Trobec commented Jan 29 '14, 2:19 p.m.

@gra

Hello Gabriel,

Thank you for the reply!

I checked the articles and now I have the correct headers and now I get the error:

java.lang.RuntimeException: com.hp.hpl.jena.shared.JenaException: org.xml.sax.SAXParseException: Premature end of file. (More info found at entry [85eaa7f3adfb094d] in RRS server log)

Here is a screenshot of the GET method using RESTClient for Firefox.


Any ideas?

Best regards,

Andrew


Andrew Trobec commented Jan 29 '14, 2:20 p.m.
Hello Gabriel,

Thank you for the reply!

I checked the articles and now I have the correct headers and now I get the error:

java.lang.RuntimeException: com.hp.hpl.jena.shared.JenaException: org.xml.sax.SAXParseException: Premature end of file. (More info found at entry [85eaa7f3adfb094d] in RRS server log)

Here is a screenshot of the GET method using RESTClient for Firefox.


Any ideas?

Best regards,

Andrew 


Gabriel Ruelas commented Jan 29 '14, 3:51 p.m.

Could you paste the complete URL used for the GET here? Thanks


Donald Nong commented Jan 29 '14, 11:52 p.m.

A sample URL is like this:
https://<host>:9443/rm/views?oslc.query=true&oslc.prefix=dc=<http://purl.org/dc/terms/>&oslc.select=*&oslc.where=dc:identifier=1234

Based on the error, the request had already been processed and the data was being retrieved but got an error when it was parsed into XML format.

Did you check the rm.log file and see what underlying error it was?

Alternatively, use the "resource" URL with the GET method to confirm the said artifact can be retrieved. Or you can try with a different artifact.


Andrew Trobec commented Jan 30 '14, 2:08 a.m.

@gra @dnong

Hello Gabriel, Donald,

Gabriel, the complete URL used for the GET is:


Donald, I used your sample URL but I get the same error.   I can get that same resource using the resource URL no problem, and unfortunately I don't have access to the the RRC log files.  Also, changing artifact ID gives me the same error.

Thanks again!

Regards,

Andrew


Gabriel Ruelas commented Jan 30 '14, 11:31 a.m.

Hi,
Query looks fine, not sure what may be happening without the logs. I suggest to contact IBM support : Here is the link: http://www-01.ibm.com/software/rational/support/contact.html

showing 5 of 6 show 1 more comments

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.