It's all about the answers!

Ask a question

Add timesheet by RTC REST API

Li Li (158) | asked Jul 20 '16, 9:34 p.m.
  I try to use OSLC to add timesheet through the following code
public boolean addDairy(String startdate,float spentTime,String timeCode,String timeCodeId,String defectId,String userId){
String url=rtcBaseURL + "/oslc/workitems/"+defectId+"/rtc_cm:timeSheet/rtc_cm:entry";//rtcBaseURL is like""
String workItem=rtcBaseURL + "/resource/itemName/" + defectId;
String creator =rtcBaseURL+"/jts/users/"+userId;
String spentTm=new DecimalFormat("#").format(spentTime*3600000);
String jsonComment = "{\"rtc_cm:workItem\":\"" + workItem + "\",\"dc:creator\":\""+creator+"\",\"rtc_cm:startDate\":\""+startdate+"\",\"rtc_cm:timeCode\":\""+timeCode+"\",\"rtc_cm:timeCodeId\":\""+timeCodeId+"\",\"rtc_cm:timeSpent\":\""+spentTm+"\"}";
JSONObject json = (JSONObject) post(url, jsonComment);
return true;

I use the code to add timesheet ,howerver it returns "HTTP/1.1 405 Method Not Allowed [Server: Apache-Coyote/1.1, Cache-Control: private, max-age=0, must-revalidate, Expires: Wed, 20 Jul 2016 06:48:54 GMT, Content-Length: 0, Date: Wed, 20 Jul 2016 06:48:54 GMT] org.apache.http.conn.BasicManagedEntity@3f4c24"

I have used the same method to add comments successfully´╝îand I want to know if I have the wrong OSLC interface about timesheet .

Be the first one to answer this question!

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.