diff --git a/src/docs/src/api/database/security.rst b/src/docs/src/api/database/security.rst index b90c832cea3..57d676f77ea 100644 --- a/src/docs/src/api/database/security.rst +++ b/src/docs/src/api/database/security.rst @@ -143,7 +143,7 @@ .. code-block:: bash - shell> curl http://localhost:5984/pineapple/_security -X PUT -H 'content-type: application/json' -H 'accept: application/json' -d '{"admins":{"names":["superuser"],"roles":["admins"]},"members":{"names": ["user1","user2"],"roles": ["developers"]}}' + shell> curl http://adm:pass@localhost:5984/pineapple/_security -X PUT -H 'content-type: application/json' -H 'accept: application/json' -d '{"admins":{"names":["superuser"],"roles":["admins"]},"members":{"names": ["user1","user2"],"roles": ["developers"]}}' .. code-block:: http diff --git a/src/docs/src/api/document/attachments.rst b/src/docs/src/api/document/attachments.rst index d6bedd5fe84..9a68cf36dfd 100644 --- a/src/docs/src/api/document/attachments.rst +++ b/src/docs/src/api/document/attachments.rst @@ -278,14 +278,14 @@ database: .. code-block:: bash - shell> curl -X PUT http://127.0.0.1:5984/test + shell> curl -X PUT http://adm:pass@127.0.0.1:5984/test {"ok":true} Then we create a new document and the file attachment in one go: .. code-block:: bash - shell> curl -X PUT http://127.0.0.1:5984/test/doc/file.txt \ + shell> curl -X PUT http://adm:pass@127.0.0.1:5984/test/doc/file.txt \ -H "Content-Type: application/octet-stream" -d@file.txt {"ok":true,"id":"doc","rev":"1-287a28fa680ae0c7fb4729bf0c6e0cf2"} @@ -293,14 +293,14 @@ Now we can request the whole file easily: .. code-block:: bash - shell> curl -X GET http://127.0.0.1:5984/test/doc/file.txt + shell> curl -X GET http://adm:pass@127.0.0.1:5984/test/doc/file.txt My hovercraft is full of eels! But say we only want the first 13 bytes: .. code-block:: bash - shell> curl -X GET http://127.0.0.1:5984/test/doc/file.txt \ + shell> curl -X GET http://adm:pass@127.0.0.1:5984/test/doc/file.txt \ -H "Range: bytes=0-12" My hovercraft diff --git a/src/docs/src/best-practices/forms.rst b/src/docs/src/best-practices/forms.rst index e97c986467d..89df53818fd 100644 --- a/src/docs/src/best-practices/forms.rst +++ b/src/docs/src/best-practices/forms.rst @@ -111,10 +111,10 @@ Here's the worked sample above, using ``curl`` to simulate the form POST. .. code-block:: bash - $ curl -X PUT localhost:5984/testdb/_design/myddoc -d '{ "updates": { "contactform": "function(doc, req) { ... }" } }' + $ curl -X PUT adm:pass@localhost:5984/testdb/_design/myddoc -d '{ "updates": { "contactform": "function(doc, req) { ... }" } }' {"ok":true,"id":"_design/myddoc","rev":"1-2a2b0951fcaf7287817573b03bba02ed"} - $ curl --data "name=Lin&email=lin@example.com&message=I Love CouchDB" http://localhost:5984/testdb/_design/myddoc/_update/contactform + $ curl --data "name=Lin&email=lin@example.com&message=I Love CouchDB" http://adm:pass@localhost:5984/testdb/_design/myddoc/_update/contactform * Trying 127.0.0.1... * TCP_NODELAY set * Connected to localhost (127.0.0.1) port 5984 (#1) @@ -139,5 +139,5 @@ Here's the worked sample above, using ``curl`` to simulate the form POST. * Connection #1 to host localhost left intact {"success":"ok"} - $ curl http://localhost:5984/testdb/lin\@example.com_2018-04-05T19:51:22.278Z + $ curl http://adm:pass@localhost:5984/testdb/lin\@example.com_2018-04-05T19:51:22.278Z {"_id":"lin@example.com_2018-04-05T19:51:22.278Z","_rev":"1-34483732407fcc6cfc5b60ace48b9da9","name":"Lin","email":"lin@example.com","message":"I Love CouchDB"} diff --git a/src/docs/src/best-practices/iso-date.rst b/src/docs/src/best-practices/iso-date.rst index c91c96215bb..50f30364e28 100644 --- a/src/docs/src/best-practices/iso-date.rst +++ b/src/docs/src/best-practices/iso-date.rst @@ -33,14 +33,14 @@ simply use ``group_level`` to zoom in on whatever time you wish to use. .. code-block:: bash - curl -X GET "http://localhost:5984/transactions/_design/widget_count/_view/toss?group_level=1" + curl -X GET "http://adm:pass@localhost:5984/transactions/_design/widget_count/_view/toss?group_level=1" {"rows":[ {"key":[20],"value":10}, {"key":[21],"value":20} ]} - curl -X GET "http://localhost:5984/transactions/_design/widget_count/_view/toss?group_level=2" + curl -X GET "http://adm:pass@localhost:5984/transactions/_design/widget_count/_view/toss?group_level=2" {"rows":[ {"key":[20,widget],"value":10}, diff --git a/src/docs/src/cluster/sharding.rst b/src/docs/src/cluster/sharding.rst index 55243805e9a..7b8ca52ff0f 100644 --- a/src/docs/src/cluster/sharding.rst +++ b/src/docs/src/cluster/sharding.rst @@ -421,7 +421,7 @@ First, retrieve the database's current metadata: .. code-block:: bash - $ curl http://localhost/_node/_local/_dbs/{name} + $ curl http://adm:pass@localhost:5984/_node/_local/_dbs/{name} { "_id": "{name}", "_rev": "1-e13fb7e79af3b3107ed62925058bfa3a", @@ -532,7 +532,7 @@ Now you can ``PUT`` this new metadata: .. code-block:: bash - $ curl -X PUT http://localhost/_node/_local/_dbs/{name} -d '{...}' + $ curl -X PUT http://adm:pass@localhost:5984/_node/_local/_dbs/{name} -d '{...}' .. _cluster/sharding/sync: @@ -643,7 +643,7 @@ Do this for all of the nodes in your cluster. For example: .. code-block:: bash - $ curl -X PUT http://localhost/_node/_local/_nodes/{node-name} \ + $ curl -X PUT http://adm:pass@localhost:5984/_node/_local/_nodes/{node-name} \ -d '{ \ "_id": "{node-name}", "_rev": "{rev}", diff --git a/src/docs/src/config/intro.rst b/src/docs/src/config/intro.rst index 10a4b6f7908..10e26b251d3 100644 --- a/src/docs/src/config/intro.rst +++ b/src/docs/src/config/intro.rst @@ -151,7 +151,7 @@ Alternatively, configuration parameters can be set via the :ref:`HTTP API `. This API allows changing CouchDB configuration on-the-fly without requiring a server restart:: - curl -X PUT http://localhost:5984/_node//_config/uuids/algorithm -d '"random"' + curl -X PUT http://adm:pass@localhost:5984/_node//_config/uuids/algorithm -d '"random"' The old parameter's value is returned in the response:: @@ -161,7 +161,7 @@ You should be careful changing configuration via the HTTP API since it's possible to make CouchDB unreachable, for example, by changing the :option:`chttpd/bind_address`:: - curl -X PUT http://localhost:5984/_node//_config/chttpd/bind_address -d '"10.10.0.128"' + curl -X PUT http://adm:pass@localhost:5984/_node//_config/chttpd/bind_address -d '"10.10.0.128"' If you make a typo or the specified IP address is not available from your network, CouchDB will be unreachable. The only way to resolve this will be @@ -182,4 +182,4 @@ cluster, as a convenience, you can use the literal string ``_local`` in place of the node name, to interact with the local node's configuration. For example:: - curl -X PUT http://localhost:5984/_node/_local/_config/uuids/algorithm -d '"random"' + curl -X PUT http://adm:pass@localhost:5984/_node/_local/_config/uuids/algorithm -d '"random"' diff --git a/src/docs/src/ddocs/views/collation.rst b/src/docs/src/ddocs/views/collation.rst index f168275a409..9fe4d729de7 100644 --- a/src/docs/src/ddocs/views/collation.rst +++ b/src/docs/src/ddocs/views/collation.rst @@ -179,7 +179,7 @@ You can demonstrate the collation sequence for 7-bit ASCII characters like this: require 'restclient' require 'json' - DB="http://127.0.0.1:5984/collator" + DB="http://adm:pass@127.0.0.1:5984/collator" RestClient.delete DB rescue nil RestClient.put "#{DB}","" diff --git a/src/docs/src/ddocs/views/pagination.rst b/src/docs/src/ddocs/views/pagination.rst index e0e3d43fd54..cdb21379699 100644 --- a/src/docs/src/ddocs/views/pagination.rst +++ b/src/docs/src/ddocs/views/pagination.rst @@ -129,7 +129,7 @@ Paging To get the first five rows from the view result, you use the ``?limit=5`` query parameter:: - curl -X GET http://127.0.0.1:5984/artists/_design/artists/_view/by-name?limit=5 + curl -X GET 'http://adm:pass@127.0.0.1:5984/artists/_design/artists/_view/by-name?limit=5' The result: @@ -156,7 +156,7 @@ we can determine if there are more pages to display. We also know by the So we query CouchDB with:: - curl -X GET 'http://127.0.0.1:5984/artists/_design/artists/_view/by-name?limit=5&skip=5' + curl -X GET 'http://adm:pass@127.0.0.1:5984/artists/_design/artists/_view/by-name?limit=5&skip=5' Note we have to use ``'`` (single quotes) to escape the ``&`` character that is special to the shell we execute curl in. diff --git a/src/docs/src/intro/api.rst b/src/docs/src/intro/api.rst index 3bf37c76f1b..310bb6471b1 100644 --- a/src/docs/src/intro/api.rst +++ b/src/docs/src/intro/api.rst @@ -613,8 +613,8 @@ easy to make):: Now we can use the database `albums-replica` as a replication target:: - curl -X POST http://adm:pass@127.0.0.1:5984/_replicate \ - -d '{"source":"http://adm:pass@127.0.0.1:5984/albums","target":"http://adm:pass@127.0.0.1:5984/albums-replica"}' \ + curl -X POST http://admin:password@127.0.0.1:5984/_replicate \ + -d '{"source":"http://admin:password@127.0.0.1:5984/albums","target":"http://admin:password@127.0.0.1:5984/albums-replica"}' \ -H "Content-Type: application/json" .. note:: @@ -681,8 +681,8 @@ and target members of our replication request are actually links (like in HTML) and so far we've seen links relative to the server we're working on (hence local). You can also specify a remote database as the target:: - curl -X POST http://adm:pass@127.0.0.1:5984/_replicate \ - -d '{"source":"http://adm:pass@127.0.0.1:5984/albums","target":"http://user:password@example.org:5984/albums-replica"}' \ + curl -X POST http://admin:password@127.0.0.1:5984/_replicate \ + -d '{"source":"http://admin:password@127.0.0.1:5984/albums","target":"http://user:password@example.org:5984/albums-replica"}' \ -H "Content-Type:application/json" Using a *local source* and a *remote target* database is called *push @@ -700,14 +700,14 @@ You can also use a *remote source* and a *local target* to do a *pull replication*. This is great for getting the latest changes from a server that is used by others:: - curl -X POST http://adm:pass@127.0.0.1:5984/_replicate \ - -d '{"source":"http://user:password@example.org:5984/albums-replica","target":"http://adm:pass@127.0.0.1:5984/albums"}' \ + curl -X POST http://admin:password@127.0.0.1:5984/_replicate \ + -d '{"source":"http://user:password@example.org:5984/albums-replica","target":"http://admin:password@127.0.0.1:5984/albums"}' \ -H "Content-Type:application/json" Finally, you can run remote replication, which is mostly useful for management operations:: - curl -X POST http://adm:pass@127.0.0.1:5984/_replicate \ + curl -X POST http://admin:password@127.0.0.1:5984/_replicate \ -d '{"source":"http://user:password@example.org:5984/albums","target":"http://user:password@example.org:5984/albums-replica"}' \ -H "Content-Type: application/json" diff --git a/src/docs/src/intro/curl.rst b/src/docs/src/intro/curl.rst index 4ce061cae04..d508abee5f7 100644 --- a/src/docs/src/intro/curl.rst +++ b/src/docs/src/intro/curl.rst @@ -26,7 +26,7 @@ to get the database information: .. code-block:: bash - shell> curl http://admin:password@127.0.0.1:5984 + shell> curl http://127.0.0.1:5984 This returns the database information (formatted in the output below for clarity): @@ -65,13 +65,13 @@ clarity): .. code-block:: bash - shell> curl -X PUT 'http://127.0.0.1:5984/demo/doc' -d '{"motto": "I love gnomes"}' + shell> curl -X PUT 'http://adm:pass@127.0.0.1:5984/demo/doc' -d '{"motto": "I love gnomes"}' you should replace it with: - .. code-blocK:: bash + .. code-block:: bash - shell> curl -X PUT "http://127.0.0.1:5984/demo/doc" -d "{""motto"": ""I love gnomes""}" + shell> curl -X PUT "http://adm:pass@127.0.0.1:5984/demo/doc" -d "{""motto"": ""I love gnomes""}" If you prefer, ``^"`` and ``\"`` may be used to escape the double-quote character in quoted strings instead. @@ -82,7 +82,7 @@ URL you send using a PUT request: .. code-block:: bash - shell> curl -X PUT http://user:pass@127.0.0.1:5984/demo + shell> curl -X PUT http://adm:pass@127.0.0.1:5984/demo {"ok":true} But to obtain the database information you use a ``GET`` request (with @@ -90,7 +90,7 @@ the return information formatted for clarity): .. code-block:: bash - shell> curl -X GET http://user:pass@127.0.0.1:5984/demo + shell> curl -X GET http://adm:pass@127.0.0.1:5984/demo { "compact_running" : false, "doc_count" : 0, @@ -120,7 +120,7 @@ submit a simple document to the ``demo`` database: .. code-block:: bash shell> curl -H 'Content-Type: application/json' \ - -X POST http://user:pass@127.0.0.1:5984/demo \ + -X POST http://adm:pass@127.0.0.1:5984/demo \ -d '{"company": "Example, Inc."}' {"ok":true,"id":"8843faaf0b831d364278331bc3001bd8", "rev":"1-33b9fbce46930280dab37d672bbc8bb9"} @@ -133,7 +133,7 @@ that was returned: .. code-block:: bash - shell> curl -X GET http://user:pass@127.0.0.1:5984/demo/8843faaf0b831d364278331bc3001bd8 + shell> curl -X GET http://adm:pass@127.0.0.1:5984/demo/8843faaf0b831d364278331bc3001bd8 {"_id":"8843faaf0b831d364278331bc3001bd8", "_rev":"1-33b9fbce46930280dab37d672bbc8bb9", "company":"Example, Inc."} diff --git a/src/docs/src/intro/security.rst b/src/docs/src/intro/security.rst index 510e8d2f166..a9cbfc32dec 100644 --- a/src/docs/src/intro/security.rst +++ b/src/docs/src/intro/security.rst @@ -330,7 +330,7 @@ Creating a new user is a very trivial operation. You just need to do a :method:`PUT` request with the user's data to CouchDB. Let's create a user with login `jan` and password `apple`:: - curl -X PUT http://localhost:5984/_users/org.couchdb.user:jan \ + curl -X PUT http://admin:password@localhost:5984/_users/org.couchdb.user:jan \ -H "Accept: application/json" \ -H "Content-Type: application/json" \ -d '{"name": "jan", "password": "apple", "roles": [], "type": "user"}' @@ -394,7 +394,7 @@ Summarizing the above process - we need to get the document's content, add the ``password`` field with the new password in plain text and then store the JSON result to the authentication database. :: - curl -X GET http://localhost:5984/_users/org.couchdb.user:jan + curl -X GET http://admin:password@localhost:5984/_users/org.couchdb.user:jan .. code-block:: javascript @@ -413,7 +413,7 @@ JSON result to the authentication database. :: Here is our user's document. We may strip hashes from the stored document to reduce the amount of posted data:: - curl -X PUT http://localhost:5984/_users/org.couchdb.user:jan \ + curl -X PUT http://admin:password@localhost:5984/_users/org.couchdb.user:jan \ -H "Accept: application/json" \ -H "Content-Type: application/json" \ -H "If-Match: 1-e0ebfb84005b920488fc7a8cc5470cc0" \ @@ -504,7 +504,7 @@ The database is now secured against anonymous reads and writes:: You declared user "jan" as a member in this database, so he is able to read and write normal documents:: - > curl -u jan:apple http://localhost:5984/mydatabase/ + > curl -u jan:orange http://localhost:5984/mydatabase/ .. code-block:: javascript diff --git a/src/docs/src/maintenance/compaction.rst b/src/docs/src/maintenance/compaction.rst index de44cc4f75a..abc0cfbb0c7 100644 --- a/src/docs/src/maintenance/compaction.rst +++ b/src/docs/src/maintenance/compaction.rst @@ -235,7 +235,7 @@ Compaction can be manually triggered per database and runs as a background task. To start it for specific database there is need to send HTTP :post:`/{db}/_compact` sub-resource of the target database:: - curl -H "Content-Type: application/json" -X POST http://localhost:5984/my_db/_compact + curl -H "Content-Type: application/json" -X POST http://adm:pass@localhost:5984/my_db/_compact On success, HTTP status :statuscode:`202` is returned immediately: @@ -271,7 +271,7 @@ for the request. If you don't, you will be aware about with HTTP status When the compaction is successful started and running it is possible to get information about it via :ref:`database information resource `:: - curl http://localhost:5984/my_db + curl http://adm:pass@localhost:5984/my_db .. code-block:: http @@ -303,7 +303,7 @@ Note that ``compact_running`` field is ``true`` indicating that compaction is actually running. To track the compaction progress you may query the :get:`_active_tasks ` resource:: - curl http://localhost:5984/_active_tasks + curl http://adm:pass@localhost:5984/_active_tasks .. code-block:: http @@ -351,7 +351,7 @@ per `design document`. To start their compaction, send the HTTP .. code-block:: bash - curl -H "Content-Type: application/json" -X POST http://localhost:5984/dbname/_compact/ddoc-name + curl -H "Content-Type: application/json" -X POST http://adm:pass@localhost:5984/dbname/_compact/ddoc-name .. code-block:: javascript @@ -372,7 +372,7 @@ When you change a view, old indexes remain on disk. To clean up all outdated view indexes (files named after the MD5 representation of views, that does not exist anymore) you can trigger a :ref:`view cleanup `:: - curl -H "Content-Type: application/json" -X POST http://localhost:5984/dbname/_view_cleanup + curl -H "Content-Type: application/json" -X POST http://adm:pass@localhost:5984/dbname/_view_cleanup .. code-block:: javascript diff --git a/src/docs/src/partitioned-dbs/index.rst b/src/docs/src/partitioned-dbs/index.rst index 695c7b91fe8..26848eb9b89 100644 --- a/src/docs/src/partitioned-dbs/index.rst +++ b/src/docs/src/partitioned-dbs/index.rst @@ -144,7 +144,7 @@ parameter: .. code-block:: bash - shell> curl -X PUT http://127.0.0.1:5984/my_new_db?partitioned=true + shell> curl -X PUT 'http://adm:pass@127.0.0.1:5984/my_new_db?partitioned=true' {"ok":true} To see that our database is partitioned, we can look at the database @@ -152,7 +152,7 @@ information: .. code-block:: bash - shell> curl http://127.0.0.1:5984/my_new_db + shell> curl http://adm:pass@127.0.0.1:5984/my_new_db { "cluster": { "n": 3, @@ -213,7 +213,7 @@ Using our earlier example, we could do this as such: ] } shell> $ curl -X POST -H "Content-Type: application/json" \ - http://127.0.0.1:5984/my_new_db -d @doc.json + http://adm:pass@127.0.0.1:5984/my_new_db -d @doc.json { "ok": true, "id": "sensor-260:sensor-reading-ca33c748-2d2c-4ed1-8abf-1bca4d9d03cf", @@ -239,7 +239,7 @@ containing the document: .. code-block:: bash - shell> curl http://127.0.0.1:5984/my_new_db/_partition/sensor-260 + shell> curl http://adm:pass@127.0.0.1:5984/my_new_db/_partition/sensor-260 { "db_name": "my_new_db", "doc_count": 1, @@ -255,7 +255,7 @@ And we can also list all documents in a partition: .. code-block:: bash - shell> curl http://127.0.0.1:5984/my_new_db/_partition/sensor-260/_all_docs + shell> curl http://adm:pass@127.0.0.1:5984/my_new_db/_partition/sensor-260/_all_docs {"total_rows": 1, "offset": 0, "rows":[ { "id":"sensor-260:sensor-reading-ca33c748-2d2c-4ed1-8abf-1bca4d9d03cf", @@ -300,13 +300,13 @@ After uploading our design document, we can try out a partitioned query: } } } - shell> $ curl -X POST -H "Content-Type: application/json" http://127.0.0.1:5984/my_new_db -d @ddoc.json + shell> $ curl -X POST -H "Content-Type: application/json" http://adm:pass@127.0.0.1:5984/my_new_db -d @ddoc.json { "ok": true, "id": "_design/sensor-readings", "rev": "1-13859808da293bd72fde3b31be97372a" } - shell> curl http://127.0.0.1:5984/my_new_db/_partition/sensor-260/_design/sensor-readings/_view/by_sensor + shell> curl http://adm:pass@127.0.0.1:5984/my_new_db/_partition/sensor-260/_design/sensor-readings/_view/by_sensor {"total_rows":4,"offset":0,"rows":[ {"id":"sensor-260:sensor-reading-ca33c748-2d2c-4ed1-8abf-1bca4d9d03cf","key":["sensor-260","0"],"value":null}, {"id":"sensor-260:sensor-reading-ca33c748-2d2c-4ed1-8abf-1bca4d9d03cf","key":["sensor-260","1"],"value":null}, @@ -354,7 +354,7 @@ that the ``"options"`` member contains ``"partitioned": false``. } } } - shell> $ curl -X POST -H "Content-Type: application/json" http://127.0.0.1:5984/my_new_db -d @ddoc2.json + shell> $ curl -X POST -H "Content-Type: application/json" http://adm:pass@127.0.0.1:5984/my_new_db -d @ddoc2.json { "ok": true, "id": "_design/all_sensors", @@ -378,7 +378,7 @@ request like: .. code-block:: bash - shell> curl -u adm:pass http://127.0.0.1:15984/my_new_db/_design/all_sensors/_view/by_field + shell> curl -u adm:pass http://adm:pass@127.0.0.1:15984/my_new_db/_design/all_sensors/_view/by_field {"total_rows":1,"offset":0,"rows":[ {"id":"sensor-260:sensor-reading-ca33c748-2d2c-4ed1-8abf-1bca4d9d03cf","key":"Bob's Corn Field #5","value":"sensor-260"} ]} diff --git a/src/docs/src/setup/single-node.rst b/src/docs/src/setup/single-node.rst index 30af61a82fb..896e2a40279 100644 --- a/src/docs/src/setup/single-node.rst +++ b/src/docs/src/setup/single-node.rst @@ -45,11 +45,11 @@ databases manually on startup: .. code-block:: sh - curl -X PUT http://127.0.0.1:5984/_users + curl -X PUT http://adm:pass@127.0.0.1:5984/_users - curl -X PUT http://127.0.0.1:5984/_replicator + curl -X PUT http://adm:pass@127.0.0.1:5984/_replicator - curl -X PUT http://127.0.0.1:5984/_global_changes + curl -X PUT http://adm:pass@127.0.0.1:5984/_global_changes Note that the last of these is not necessary if you do not expect to be using the global changes feed. Feel free to delete this database if you