minsql
minsql copied to clipboard
minsql rest api returns "unauthorized"
Following along with the minsql repo documentation and the examples, I fail to create a datastore after setting minsql up with a metabucket.
The below command points to some playground bucket, but the response is "401: Unauthorized"
curl -X POST \
http://127.0.0.1:9999/api/datastores \
-H 'Content-Type: application/json' \
-d '{
"bucket" : "play-minsql",
"endpoint" : "https://play.minio.io:9000",
"prefix" : "",
"name" : "minioplay",
"access_key" : "Q3AM3UQ867SPQQA43P2F",
"secret_key" : "zuf+tfteSlswRu7BJ86wekitnifILbZam1KYY3TG"
}'
Trying to point the request to my local minio instance like below yields the same unauthorized response:
curl -X POST \
http://127.0.0.1:9999/api/v1/datastores \
-H 'Content-Type: application/json' \
-d '{
"bucket" : "minsql-meta",
"endpoint" : "https://localhost:9000",
"prefix" : "",
"name" : "miniotest",
"access_key" : "minio",
"secret_key" : "minio123"
}'
My guess was that I needed to get a token first (in contrary to the order in which the numbered list of the guide is proposing), so I tried to POST to /api/tokens/ as below, but still only get unauthorized response. Tried replacing "abcde..." with "minio" and "minio123" from the docs, but no difference.
curl -X POST \
http://127.0.0.1:9999/api/tokens \
-H 'Content-Type: application/json' \
-d '{
"access_key" : "abcdefghijklmnop",
"secret_key" : "abcdefghijklmnopabcdefghijklmnop",
"description" : "test",
"is_admin" : true,
"enabled" : false
}'