John
John

Reputation: 329

Trying to use API key with curl to access Cloudant

I want to use curl to access Cloudant without my user and password. I've created an API key for a database, have a key & password combination, and have granted admin, read, and write permission to the API key. Now what? Where do I specify the key and/or password?

I tried:

curl -u key https://user.cloudant.com/_all_dbs

It asks for the password for which I supply the password associated with the key and I get:

{"error":"forbidden","reason":"one of _all_dbs, _admin, server_admin is required for this request"}

I can form a command using my real user and password but I want to avoid that!

Upvotes: 1

Views: 840

Answers (1)

brobes
brobes

Reputation: 716

The difference is between Authentication and Authorization. You need to authenticate with a username and password to admin the database or use the web dashboard — or do things like get _all_dbs. API keys only work to give access to specific databases with specific permissions. So even if you give the API key access to all the databases, your call to _all_dbs_ still shouldn't work. Hope that helps.

Upvotes: 2

Related Questions