Hello, I trying to write in Influxdb with a C# application and it does not
working correctly. Could you provide me some examples or tell me where could I
find them?
This is my code:
public static void writeInflush() {
NameValueCollection queryString = HttpUtility.ParseQueryString(string.Empty);
queryString[""] = "pm_ccc";
queryString["pm"] = "0043P";
queryString["env_cecre"] = "1";
queryString["valor"] = "127.3";
queryString["calidad"] = "0";
queryString["origen"] = "auto";
String parametros = queryString.ToString();
enviarInflush("http://dbserv3:8086/write?db=PRUEBA", parametros);
}
public static String enviarInflush(String url, String param) {
try {
// create a request
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(new Uri(url));
request.Accept = "*/*";
request.ContentType = "*/*";
request.Method = "POST";
request.ContentLength = param.Length;
UTF8Encoding encoding = new UTF8Encoding();
Byte[] bytes = encoding.GetBytes(param);
Stream str = request.GetRequestStream();
str.Write(bytes, 0, bytes.Length);
str.Close();
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
StreamReader strRd = new StreamReader(response.GetResponseStream());
string result = strRd.ReadToEnd();
return result;
} catch (Exception e) {
return e.StackTrace;
}
}
The error code is 400. Any idea? Thanks,
--
Remember to include the InfluxDB version number with all issue reports
---
You received this message because you are subscribed to the Google Groups
"InfluxDB" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/influxdb.
To view this discussion on the web visit
https://groups.google.com/d/msgid/influxdb/f81752e0-fedf-47f0-90fd-d2a068b063cc%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.