Gzip encoding with API POST

Per this documentation I should be able to use the header {Content-Encoding: gzip} to compress line protocol send to InfluxDB via API.

However, this returns a 500 error (“An internal error has occurred.”)

Using “application/gzip” instead of just “gzip” returns a 204.

Is there a way to verify that this is successfully compressing the payload? If application/gzip isn’t an equivalent substitution, what would cause gzip compression to create an error?

Thank you.

@jw.blaney, Content-Encoding: gzip works OK. It is used, for example, in InfluxDB 2 clients.
How do you write the data? It is really gzipped?

2 Likes

@jw.blaney echoing @VlastaHajek, setting Content-Encoding: gzip tells the server that it should attempt to gunzip the request body before parsing it, which will only work if the body is actually gzipped. If you’re using the API directly then you’ll need to manually gzip your line-protocol before including it in the request.

1 Like