How consume jazz Reportable REST API programmatically using java
Accepted answer
https://jazz.net/library/article/635
https://jazz.net/wiki/bin/view/Main/OSLCWorkshopDownload
I modified Example03.java to call https://localhost:9443/ccm/rpt/repository/workitem?fields=workitem/workItem/id API like below. I hope this might help you. Cheers.
public static void main(String[] args) {
//============== Code to adapt to your own configuration =============//
String server = "https://localhost:9443/ccm"; // Set the Public URI of your RTC server
String login = "clmadmin"; // Set the user login
String password = "clmadmin"; // Set the associated password
//============== -------------------------------------- =============//
String reportAPI = server + "/rpt/repository/workitem?fields=workitem/workItem/id";
// Setup the HttClient
HttpClient httpclient = new DefaultHttpClient();
HttpUtils.setupLazySSLSupport(httpclient);
// Setup the rootServices request
HttpGet reportDoc = new HttpGet(reportAPI);
reportDoc.addHeader("Accept", "application/rdf+xml");
try {
// Request the Root Services document
HttpResponse reportResponse = HttpUtils.sendGetForSecureDocument(
server, reportDoc, login, password, httpclient);
HttpUtils.printResponseBody(reportResponse);
reportResponse.getEntity().consumeContent();
Comments
Thanks Kohji, Work!
Another question:
The Reportable REST API have a operator similar"oslc.searchTerms"?
I need to do a search based on the content of comments , Like This: https://localhost:9443/ccm/rpt/repository/workitem?fields=workitem/workItem//comments[content contains "pattern"]/comments/content
its possible?
Hi Rodrigo,
Looking at the XPath specification is right. But, do not work for me too.
No problem... I'll take the full content of comments and search programmatically.
Thanks for the trouble.