It seems likely there is a syntax error somewhere in the code. I don't read
C# well enough to recreate the output. Can you include an example of the
actual body of the POST?

On Mon, Jul 18, 2016 at 9:06 AM, Brannon King <[email protected]> wrote:

> Here's a bit of working sample code. I'm using HttpClient.PostAsync called
> periodically. I'm not setting any headers. I'm using the PushStreamContent
> class for my content. I loop through the items in the queue and write them
> to the stream after converting them to UTF8.
>
> private async Task SendQueue(ConcurrentQueue<char[]> queue, string
> retentionPolicyName)
> {
> var content = CreateContent(queue);
> var uri = new Uri(_influxHttpdAddress).SetPath(_port, "write");
> if (!_influxHttpdAddress.Contains("db="))
> uri = uri.AddQuery("db", _databaseName);
> if (!_influxHttpdAddress.Contains("rp="))
> uri = uri.AddQuery("rp", retentionPolicyName);
> try
> {
> var response = await _client.PostAsync(uri, content).ConfigureAwait(false);
> if (response.StatusCode == HttpStatusCode.BadRequest)
> throw new Exception("Write failure: " + await
> response.Content.ReadAsStringAsync().ConfigureAwait(false));
> // for debugging:
> //if (response.StatusCode == HttpStatusCode.InternalServerError)
> // throw new Exception("Server error: " + await
> response.Content.ReadAsStringAsync().ConfigureAwait(false));
> //if (response.StatusCode != HttpStatusCode.NoContent)
> // throw new Exception("Write failure: " + await
> response.Content.ReadAsStringAsync().ConfigureAwait(false));
> }
> catch (Exception ex)
> {
> logger.Error(ex);
> // may fail during shutdown
> }
> }
>
> --
> 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/c9acc658-018d-4a77-a5ba-000a9119f991%40googlegroups.com
> <https://groups.google.com/d/msgid/influxdb/c9acc658-018d-4a77-a5ba-000a9119f991%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>
> For more options, visit https://groups.google.com/d/optout.
>



-- 
Sean Beckett
Director of Support and Professional Services
InfluxDB

-- 
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/CALGqCvNhRSX7nE8hChda7a2Rco4igy3GyB_zp%3Dj90Qf47ZOdzw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to