How to update testcase using OSLC api
Hi ,
I am trying to update testcase using apache http client and oslc .
Put request is as follows:
String testcaseUpdateURL : https://<server>:<port>/qm/oslc_qm/context/<context_id>/resources/com.ibm.rqm.planning.VersionedTestCase?oslc.where=oslc:shortId=%22<testcase_id>%22.
HttpPut updateTC = new HttpPut(testcaseUpdateURL );
updateTC.addHeader("Accept", "application/xml");
updateTC.addHeader("Content-type", "application/rdf+xml");
updateTC.addHeader("OSLC-Core-Version","2.0");
updateTC.setEntity(entity); // entity is xml data encoded in UTF_8 format
HttpResponse updateTcResponse = HttpUtils.sendPutForSecureDocument(
server, updateTC , login, password, httpclient);
System.out.println(updateTcResponse.getStatusLine().getStatusCode());
I got output as 302
|
Accepted answer
The URL you are using is an OSLC query, not the URL of a resource. PUT would not be possible on a query URL. Chaitali Kulkarni selected this answer as the correct answer
Comments
Chaitali Kulkarni
commented Jan 10 '18, 10:55 p.m.
Yeah, I was hitting invalid url. I can now able to update testcase. |
One other answer
I suspect that you were being redirected to the login page because you did not authenticate to the server properly. It appears that you tried to do Basic Authentication during the PUT, which is not possible when most servers are using Form Based Authentication (by default).
|
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.