Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[0.13] CREATE DATABASE through /query accepts only GET, not POST #493

Closed
zstyblik opened this issue Jun 6, 2016 · 4 comments
Closed

[0.13] CREATE DATABASE through /query accepts only GET, not POST #493

zstyblik opened this issue Jun 6, 2016 · 4 comments

Comments

@zstyblik
Copy link

zstyblik commented Jun 6, 2016

Hello,

in influxdata/influxdb#6787 came up that /query?q=CREATE+DATABASE+"test_test" accepts only GET, but documentation(link below) suggests to use POST which seems to be either wrong or outdated.
I have verified this with InfluxDB v0.13.0 Web UI, resp. that Web UI is making that GET call to create a new database.

Thanks.

URL for relevant page?

https://docs.influxdata.com/influxdb/v0.13/guides/writing_data/

What products and version are you using?

Verified as an issue with InfluxDB v0.13

Where did you look before opening the issue?

@beckettsean
Copy link
Contributor

Docs aren't wrong, there's something else going on.

On Ubuntu 14.04 with InfluxDB 0.13.0 I have no issues creating a database using POST or GET:

# curl -POST http://localhost:8086/query --data-urlencode "q=CREATE DATABASE foofoo"
{"results":[{}]}
root@sean-stable:~# influx
Visit https://enterprise.influxdata.com to register for updates, InfluxDB server management, and monitoring.
Connected to http://localhost:8086 version 0.13.0
InfluxDB shell version: 0.13.0
> show databases
name: databases
---------------
name
telegraf
_internal
mydb
foofoo

> exit

# curl http://localhost:8086/query --data-urlencode "q=CREATE DATABASE fooget"
{"results":[{}]}
> show databases
name: databases
---------------
name
telegraf
_internal
mydb
foofoo
fooget

Also, please note the web UI is basically deprecated. The CLI is the preferred method of interaction with the system.

@zstyblik
Copy link
Author

zstyblik commented Jun 6, 2016

@beckettsean, Web UI deprecated? That's the first time I'm hearing this. Ok. I can re-verify with curl tomorrow and will get back to you/this ticket.
However, GET shouldn't be accepted(in my opinion) as per #462. Although, as I've mentioned in the other ticket, may be that's for upcoming release.

Anyway, until tomorrow then.

@beckettsean
Copy link
Contributor

I believe the original error was the result of improper curl syntax and not anything amiss with the database.

@zstyblik
Copy link
Author

zstyblik commented Jun 7, 2016

@beckettsean, I've re-verified and it's true. POST works and GET returns a deprecation warning.

curl -vvv -XPOST http://XXX:8086/query --data-urlencode 'q=CREATE DATABASE "test_test"'
* Hostname was NOT found in DNS cache
*   Trying 192.168.XXX...
* Connected to XXX (192.168.XXX) port 8086 (#0)
> POST /query HTTP/1.1
> User-Agent: curl/7.38.0
> Host: XXX:8086
> Accept: */*
> Content-Length: 37
> Content-Type: application/x-www-form-urlencoded
> 
* upload completely sent off: 37 out of 37 bytes
< HTTP/1.1 200 OK
< Connection: close
< Content-Type: application/json
< Request-Id: 0c97edc8-2c7c-11e6-a443-000000000000
< X-Influxdb-Version: 0.13.0
< Date: Tue, 07 Jun 2016 06:49:58 GMT
< Content-Length: 16
< 
* Closing connection 0
{"results":[{}]}

curl -vvv -XGET 'http://XXX:8086/query?q=CREATE%20DATABASE%20test'
* Hostname was NOT found in DNS cache
*   Trying 192.168.XXX...
* Connected to XXX (192.168.XXX) port 8086 (#0)
> GET /query?q=CREATE%20DATABASE%20test HTTP/1.1
> User-Agent: curl/7.38.0
> Host: XXX:8086
> Accept: */*
> 
< HTTP/1.1 200 OK
< Connection: close
< Content-Type: application/json
< Request-Id: 139b00c2-2c7c-11e6-a449-000000000000
< X-Influxdb-Version: 0.13.0
< Date: Tue, 07 Jun 2016 06:50:09 GMT
< Content-Length: 156
< 
* Closing connection 0
{"results":[{"messages":[{"level":"warning","text":"deprecated use of 'CREATE DATABASE test' in a read only context, please use a POST request instead"}]}]}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants