Line protocol error 204

I’m trying to upload measurments via InfluxDB line protocol. Here’s the line:

test,type=VDC value=+0.0002E+0 1615216415900566016

For which I get:

WARNING:root:Request failed (status=‘400’, reason=‘Bad Request’, response=‘b’{“error”:“unable to parse ‘test,type=VDC value=+0.0002E+0 1615216415900566016’: invalid boolean”}\n’’, params=‘db=DB_name&precision=ns’):

I suspect that the problem is with the scientific notation +0.0002E+0.

So I try another:

test,type=VDC value=0.034 1615216542458520320

For which I get:

influxdb.InfluxdbError: Request failed (status=‘204’, reason=‘No Content’, response=‘b’’’, params=‘db=DB_name&precision=ns’):

This confirms that there’s something wrong with my scientific notation, maybe the +?

But for the second where there’s no scientific notation what is the problem?

As far as i know, scientific notation is not supported in the influx line protocol.

1 Like

Hi,

https://docs.influxdata.com/influxdb/v1.8/write_protocols/line_protocol_reference/

But still, if we forget about scientific notation and follow the second example why does this fail too?

I’m sorry, I guess I was wrong… :innocent:

https://docs.influxdata.com/influxdb/v2.0/reference/syntax/line-protocol/#data-types-and-format

Then I suspect there is another problem. How do you get the data into the InfuxDB?

1 Like

It’s a python script that parses serial data and sends it into InfluxDB:

This:

test,type=VDC value=+0.0002E+0 1615216415900566016

is straight the data that is send to InfluxDB according to the debug of the program.

I suspect there’s nothing wrong with the line then?

I don’t know this python script, I have no idea what’s going on under the hood …
Yes, theoretically, the line looks ok.
The scientific notation still looks a bit strange?

1 Like

I think I read somewhere recently that flux doesn’t (yet?) support float scientific notation numbers, despite that example in the doco .

I’m not in front of my pc to test it myself, but to prove it, try converting a few line records manually to the equivalent float number and see if they insert successfully

1 Like

Like this?:

influxdb.InfluxdbError: Request failed (status=‘204’, reason=‘No Content’, response=‘b’’’, params=‘db=DB_name&precision=ns’): test,type=VDC value=0.034 1615271960057440768

Error 204

The error 400 may be due to the scientific notation. But error 204?

Which InfluxDB version do you use?

Nice :+1:
I missed you had already tried that. Http code 204 is a success response according to the docs here

https://docs.influxdata.com/influxdb/v2.0/api/#operation/PostWrite

1 Like

I’m using InfluxDB 1.8.4

So I suppose Request failed is just a missinterpretation of the python script.

Later I will see if it really updates data.

I just saw you mention your on 1.x still, suggest starting on migration and upgrade planning soon to 2.x, as 1.x probably won’t get any further version updates, other than critical bug fixes.

I can’t comment on the rest api differences with 1.x either, but they should be similar with 2.x

1 Like

Yes i think there is a bug in this script:

if status / 100 != 2:

Assuming that 204 is a valid status code, this query will always fail.
I suspect this is a holdover from Python 2 days that no longer works that way under Python 3.

1 Like