Search code examples
databasehttpcurlterminalcouchdb

Loggin into COUCHDB using curl


I would like to get the .json data from a specific http. The data I need for this is on a COUCHDB. Now when I curl http://example.com:port/mydatabase I get the message "You are not authorized to access this db. "I have now received header data with 1: roles, 2:username and a token. How do I enter my curl to get access to the database.

Tanks from Student.


Solution

  • The first thing to check is that you have created credentials for your database installation. You can read about that in the docs here. Once that's in place, you can do basic auth with curl by passing your credentials as part of the URL:

    curl 'https://USERNAME:[email protected]:port/mydatabase/_all_docs'
    

    More notes on how to use curl with couchdb are available here.