title: How to get Data from InfluxDB API used HttpClient
body: <p>Please somebody help me...</p>
  <p>How to get InfluxDB v2 query Data...? used HttpClient.</p>
  <p>I want to get query result data but no result just empty result</p>
  <p>that image is I wanna data result.</p>
  <p><img src="https://i.stack.imgur.com/4hENL.jpg" alt="enter image description here" /></p>
  <p>this is my code, can you give me Resolutions( 1. post(URL, query) -&gt; read data in one method solutions 2. post method, get method 2 method solutions)</p>
  <pre><code>public async System.Threading.Tasks.Task&lt;HttpResponseMessage&gt; RequestQuery()
  {
      // client = new HttpClient();
  
      HttpClient client = new HttpClient();
  
      int refreshTime = 5;
  
      client.DefaultRequestHeaders.Add(&quot;Authorization&quot;, &quot;Token &quot; + token);
      client.DefaultRequestHeaders.Add(&quot;Accept&quot;, &quot;application/csv&quot;);
  
      var fluxQuery = &quot;from(bucket: \&quot;DT_Object\&quot;)\n&quot;
                     + &quot;|&gt; range(start: -7d)&quot;
                     + &quot;|&gt; filter(fn: (r) =&gt; r[\&quot;_measurement\&quot;] ==\&quot; NPC\&quot;)&quot;
                     + &quot;|&gt; filter(fn: (r) =&gt; r[\&quot;NAME\&quot;] == \&quot;NPC\&quot;)&quot;
                     + &quot;|&gt; filter(fn: (r) =&gt; r[\&quot;_field\&quot;] == \&quot;X\&quot; or r[\&quot;_field\&quot;] == \&quot;Y\&quot; or r[\&quot;_field\&quot;] == \&quot;Z\&quot;)&quot;
                     + &quot;|&gt; aggregateWindow(every: &quot;+ refreshTime + &quot;s, fn: mean, createEmpty: false)&quot;
                     + &quot;|&gt; yield(name: \&quot;mean\&quot;)&quot;;
  
      var data = new StringContent(fluxQuery, Encoding.UTF8, &quot;application/vnd.flux&quot;);
  
      var response = await client.PostAsync(requestUrl, data);
      Debug.Log(response);
  
      if (response.ReasonPhrase == &quot;OK&quot;)
      {
          GetData1();
      }
  
      string result = response.Content.ReadAsStringAsync().Result;
  
      client.Dispose();
  
      return response;
  }
  
  
   public string GetData1()
  {
      string responseFromServer = string.Empty;
  
      try
      {
          WebRequest request = WebRequest.Create(&quot;http://localhost:8086/api/v2/query?org=DT_navigator&quot;);
          request.Method = &quot;GET&quot;;
          request.ContentType = &quot;text/csv&quot;;
          request.Timeout = 10 * 1000; // 10초
          request.Headers.Add(&quot;Authorization&quot;, &quot;Token &quot; + token);
  
          using (WebResponse response = request.GetResponse())
          using (Stream dataStream = response.GetResponseStream())
          using (StreamReader reader = new StreamReader(dataStream))
          {
              responseFromServer = reader.ReadToEnd();
          }
          Debug.Log(&quot;Influx data : &quot; + responseFromServer);
      }
      catch (Exception e)
      {
          Debug.Log(e.ToString());
      }
  
      return responseFromServer;
  }
  </code></pre>