Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

How to extract Timesheet data using Rally WS API?

How to extract Timesheet data using Rally WS API?

Problem

I want all the time entries between two specific dates, regardless of the time they were entered. Must I query the time entry items, then get the _ref value for the values in separate requests.

Is there a more efficient way to get to the hours? Maybe an example piece of code?

Problem courtesy of: JPKole

Solution

Whether you choose to start with a TimeEntryItem and traverse to TimeEntryValues, or the other way around, depends on the problem you are trying to solve. If, for example, you would like to aggregate time, you may choose Item -> Values direction.

Here are two examples written with Rally REST tookit for Node:

var rally = require('rally'),
    queryUtils = rally.util.query,
    restApi = rally({
        user: '[email protected]', 
        pass: 'secret', 
        apiVersion: 'v2.0', 
        server: 'https://rally1.rallydev.com',  
        requestOptions: {
            headers: {
                'X-RallyIntegrationName': 'Timesheet data: from TEItem to TEValue',  
                'X-RallyIntegrationVendor': 'Rally',             
                'X-RallyIntegrationVersion': '1.0'                    
            },
        }
    });

function getTimeEntryValues(result) {
    for(var i = 0, length = result.Results.length; i =','2014-01-01T00:00:00.000Z' );
   query = query.and('WeekStartDate', '

Here is a second example that queries on TimeEntryValues first and then queries on TimeEntryItems:

var rally = require('rally'),
    queryUtils = rally.util.query,
    restApi = rally({
        user: '[email protected]', 
        pass: 'secret', 
        apiVersion: 'v2.0', 
        server: 'https://rally1.rallydev.com',  
        requestOptions: {
            headers: {
                'X-RallyIntegrationName': 'Timesheet data node.js program',  
                'X-RallyIntegrationVendor': 'Rally',             
                'X-RallyIntegrationVersion': '1.0'                    
            },
        }
    });

 function getTimeEntryValues() {

    var query = queryUtils.where('DateVal', '>=','2014-01-08T00:00:00.000Z' );
    query = query.and('DateVal', '
Solution courtesy of: nickm

Discussion

View additional discussion.



This post first appeared on Node.js Recipes, please read the originial post: here

Share the post

How to extract Timesheet data using Rally WS API?

×

Subscribe to Node.js Recipes

Get updates delivered right to your inbox!

Thank you for your subscription

×