It's all about the answers!

Ask a question

How Can I Use the OSLC API to Generate TimeSheetEntries?

Nate Decker (37813058) | asked Oct 09 '13, 10:11 a.m.

I am investigating creating a tool to keep track of the time spent working on tasks in RTC. The tool will run outside of the eclipse client and will incorporate a Record/Stop feature. Whe the user selects "Record", the tool will start a timer. When the user selects "Stop", the tool will automatically generate a TimeSheetEntry in the appropriate Work Item's Time Tracking tab in RTC.

In order to make this work, I need to be able to programmatically modify the TimeSheetEntries on the Time Tracking tab of a work item in RTC. I've read that you cannot do this using REST APIs, but it appears that this should be possible using OSLC APIs. I've already successfully used the OSLC API in the past to update things like a Work Item's summary or description. However, I've had a hard time duplicating that feat with collections associated with a Work Item (e.g., Approvals and TimeSheetEntries). I'm able to directly modify the work item's "Time Spent" attribute, but cannot seem to do that for a specific TimeSheetEntry. I've only had success doing it for the Work Item as a whole.

Can anyone point me at a resource (or provide me with some code examples) of how you can do this with the OSLC API? My programming language of choice is VB.Net.

3 answers

permanent link
Ralph Schoon (61.1k33643) | answered Mar 31 '15, 10:45 a.m.
For anyone who searches for example, I created example code to access and modify the time tracking data for work items and published in this post:

This is however for the Plain Java API. However, the information there might help with understanding how to set the data using OSLC as well. Basically it is necessary to retrieve the linked entries and to update/create entries and link them to the work item.

Nate Decker commented Mar 31 '15, 11:45 a.m.

Your timing is supernatural. My understanding in the past was that the OSLC API cannot create Timesheet entries, only read them. I had given up on the idea. However, just this morning it occurred to me that I could implement a work-around by adding a specially formatted comment to Work items via OSLC and then having a server-side operation behavior detect and parse that comment to create the Timesheet entries.

I was literally about to search for posts on accessing timesheet entries via the Java API when I received your comment notification. So I say again, your timing is supernatural.

I'll have to take a look at your example. I'm looking at doing this with a Server-Side extension and am not sure if that's what your example code does, but hopefully even if it is client-side, it will be similar enough to be of use.


Ralph Schoon commented Apr 01 '15, 2:49 a.m.

Hi Nate,

coincidence 8)

I just had a look and the code is only using IWorkItemCommon for the timesheet related work. This is available in the server API as well.

I tidied up some imports and another place in the code and uploaded a new version.

permanent link
Eric Jodet (6.3k5111120) | answered Oct 11 '13, 3:24 a.m.
 Hello Nate,
should help you.


permanent link
Nate Decker (37813058) | answered Feb 28 '14, 1:03 p.m.
edited Apr 02 '14, 9:11 a.m.

It's been a while, but now that I have the time, I am returning to this side project.

The link you've provided is helpful, but it's focused on reading data from a TimeSheetEntry. I can successfully retrieve the data by following the example procedure, but I can't seem to make a change to the existing data by using the "PUT" method. Does anyone know of a way to do this?

I've identified certain strings that return a status of "OK", but it doesn't appear to actually modify the TimeSheetEntries within the Work Item record. When I look at the history, I can see that I am able to successfully change the "time spent", but again, the TimeSheetEntries on the "Time Tracking" tab appear to be unaffected.

Update: I was unfamiliar with Firebug and thought this was a 3rd-party extension for Firefox. It appears to be built-in to Firefox though so this may be a good avenue. However, I recently monitored the network traffic using the Firefox Debugger while saving a timesheet entry and the traffic was all defined in JSON format. All of my OSLC API queries have been in text/XML format so it was difficult to figure out what was going on in the JSON presentation. Is there a way to see the firebug data in XML?

Eric Jodet commented Mar 18 '14, 10:51 a.m.

 Hello Nate,

not sure I have the answer here - the Wiki page is about "fetching" values,
not setting them.
I would start by using FF and Firebug,
add a timesheet entry and save.
Check what we POST to the server.

Your answer

Register or to post your answer.