timeseries-examples/CSVexport/csvexport.js
// fetch requested timeseries as JSON encoded payload
fetch requested timeseries as JSON encoded payload
fetch requested timeseries as JSON encoded payload
function fetchTimeseries(key, entity, tsid, aggr, time, env, rfunc) {
	var options = {
		host: env + '.live.dynatrace.com',
		path: '/api/v1/timeseries/?Api-Token=' + key + '&relativeTime=' + time + '&entity=' + entity + '&aggregationType=' + aggr + '&timeseriesId=' + tsid	
	};
	callback = function(response) {
		var str = '';
		response.on('data', function (chunk) {
			str += chunk;
		});
		response.on('end', function () {
			var result = JSON.parse( str );
			rfunc(result.result.dataPoints[entity]);
		});
	}
	https.request(options, callback).end();
}
function fetchTimeseries ( key , entity , tsid , aggr , time , env , rfunc ) { var options = { host : env + '.live.dynatrace.com' , path : '/api/v1/timeseries/?Api-Token=' + key + '&relativeTime=' + time + '&entity=' + entity + '&aggregationType=' + aggr + '&timeseriesId=' + tsid } ; callback = function ( response ) { var str = '' ; response . on ( 'data' , function ( chunk ) { str += chunk ; } ) ; response . on ( 'end' , function ( ) { var result = JSON . parse ( str ) ; rfunc ( result . result . dataPoints [ entity ] ) ; } ) ; } https . request ( options , callback ) . end ( ) ; }
fetch requested timeseries as JSON encoded payload
fetch requested timeseries as JSON encoded payload
// all data was received, send the result as JSON array