In order to use v2 buckets using v1 API, you need DBRP mappings and in order to authorize using HTTP Basic scheme, as v1 clients use, you need a v1 authorization.
These are automatically created during the upgrade.
If you didn’t go through the upgrade process, you have to create them manually using Influx CLI or API.
How to create them using influx CLI:
I have org my-org, bucket my-bucket, V2 authorization token my-token.
You need to know a bucket ID:
> influx bucket list -t my-token -o my-org
ID Name Retention Shard group duration Organization ID
8a86c88bdb311d3d _monitoring 168h0m0s 24h0m0s e2e2d84ffb3c4f85
e0f636e0e399b0cf _tasks 72h0m0s 24h0m0s e2e2d84ffb3c4f85
d98ced31b2232519 my-bucket infinite 168h0m0s e2e2d84ffb3c4f85
So my-bucket ID is d98ced31b2232519.
Create v1 authorization:
> influx v1 auth create -o my-org --username userv1 --password password1 -t my-token --read-bucket d98ced31b2232519 --write-bucket d98ced31b2232519
ID Description Name / Token User Name User ID Permissions
0824b948a1b21000 userv1 my-user 0801faee4cc36000 [read:orgs\e2e2d84ffb3c4f85\buckets\d98ced31b2232519 write:orgs\e2e2d84ffb3c4f85\buckets\d98ced31b2232519]
userv1 is new username for authenticating using v1 API and password1 is her password.
Now the query works, but it returns an empty results set:
> curl -X POST http://localhost:8086/query -u "userv1:password1" --data-urlencode 'q=SHOW DATABASES'
{"results":[{"statement_id":0,"series":[{"name":"databases","columns":["name"]}]}]}
DBRP mapping is needed to see v2 bucket using v1 API:
> influx v1 dbrp create --db mydb --rp default --bucket-id d98ced31b2232519 -o my-org -t my-token
ID Database Bucket ID Retention Policy Default Organization ID
082432e71e721000 mydb d98ced31b2232519 default false e2e2d84ffb3c4f85
mydb and default are new names for database and retention policy for v1 API.
Now the query finally works ok:
> curl -X POST http://localhost:8086/query -u "userv1:password1" --data-urlencode 'q=SHOW DATABASES'
{"results":[{"statement_id":0,"series":[{"name":"databases","columns":["name"],"values":[["mydb"]]}]}]}