public bool PostTimeSeriesData(string timeseriesname, List <KeyValuePair <DateTime, List <object> > > timeseries, List <string> columns) { string uristring = String.Format("http://{0}:{1}/db/{2}/series?u={3}&p={4}", Server, Port.ToString("0"), Database, User, Password); Uri url = new Uri(uristring); InfluxReturnObject o = new InfluxReturnObject(); o.Name = timeseriesname; o.Columns = new List <string>() { "time" }; o.Columns.AddRange(columns); o.Points = new List <List <object> >(); foreach (var e in timeseries) { if (e.Value.Count == columns.Count) { List <object> templist = new List <object>(); templist.Add(DateTimeToMillisecondsSinceEpoche(e.Key)); templist.AddRange(e.Value); o.Points.Add(templist); } } string json = JsonConvert.SerializeObject(o); return(PostJSONToURL(url, json)); }
public bool PostTimeSeriesData(string timeseriesname, List<KeyValuePair<DateTime, List<object>>> timeseries, List<string> columns) { string uristring = String.Format("http://{0}:{1}/db/{2}/series?u={3}&p={4}", Server, Port.ToString("0"), Database, User, Password); Uri url = new Uri(uristring); InfluxReturnObject o = new InfluxReturnObject(); o.Name = timeseriesname; o.Columns = new List<string>() { "time" }; o.Columns.AddRange(columns); o.Points = new List<List<object>>(); foreach (var e in timeseries) { if (e.Value.Count == columns.Count) { List<object> templist = new List<object>(); templist.Add(DateTimeToMillisecondsSinceEpoche(e.Key)); templist.AddRange(e.Value); o.Points.Add(templist); } } string json = JsonConvert.SerializeObject(o); return PostJSONToURL(url, json); }