0
I want to send data to Influxdb rest API v2. However, I get a 400 error and cannot send data. Because unity is being used, the corresponding influxDB.client library conflicts with assembly and cannot be used. How do I send data to influxDb 2.0 and write it?
this is my code
const string url = "http://localhost:8086/api/v2/write org=DT_navigator&bucket=test_bk&precision=s";
async System.Threading.Tasks.Task WriteDataAsync()
{
var json = JsonConvert.SerializeObject("mem,host=host1 used_percent=23");
var data = new StringContent(json, Encoding.UTF8, "application/json");
HttpClient client = new HttpClient();
client.DefaultRequestHeaders.Add("Authorization", "Token " + token);
var response = await client.PostAsync(url, data);
string result = response.Content.ReadAsStringAsync().Result;
Debug.Log(result);
}
and error message {ācodeā:āinvalidā,āmessageā:āunable to parse āāmem,host=host1 used_percent=23āā: invalid numberā}