Issue with url percent encoding for GET or POST requests

Hi, I’m trying to use curl to read/write data, without having to use -d or --data-urlencode options.
The GET works just fine i.e
curl -G 'http://localhost:8086/query' --data-urlencode "db=test" --data-urlencode "q=SELECT * FROM \"www\" "
returns the equivalent result to:
curl -G 'http://localhost:8086/query?db=test&q=SELECT%20value%20FROM%20www'

However that’s not the case with POST request.
Writing the following effectively inserts provided data:
curl -i -XPOST 'http://localhost:8086/write?db=test' -d "www,tagg=54 value=100"
but the next command makes no changes inside the database (and outputs no particular error)
curl -i -XPOST 'http://localhost:8086/write?db=test&www%2Ctagg%3D78%20value%3D75'
Both POST requests return the same “204 No Content” response as if they were both successful.

tl;dr : Is there a syntax to encode a write request into the url instead of using curl “-d” option ?

Note: the reason for this is that i’m trying to use grafana’s AJAX plugin to write some data into my influx database and I can’t quite figure how to do it without having everything pre-encoded inside the url text box

1 Like