Skip to content
This repository was archived by the owner on Oct 17, 2022. It is now read-only.

Update _config endpoint documentation to reflect new location #109

Merged
merged 3 commits into from
Mar 17, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/api/server/common.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1036,7 +1036,7 @@ could be changed to ``random`` by sending this HTTP request:

.. code-block:: http

PUT http://couchdb:5984/_config/uuids/algorithm HTTP/1.1
PUT http://couchdb:5984/_node/nonode@nohost/_config/uuids/algorithm HTTP/1.1
Content-Type: application/json
Accept: */*

Expand Down
35 changes: 19 additions & 16 deletions src/api/server/configuration.rst
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ Configuration
The CouchDB Server Configuration API provide an interface to query and update
the various configuration values within a running CouchDB instance.

``/_config``
============
``/_node/{node-name}/_config``
==============================

.. http:get:: /_config
.. http:get:: /_node/{node-name}/_config
:synopsis: Obtains a list of the entire server configuration

Returns the entire CouchDB server configuration as a JSON structure. The
Expand All @@ -40,7 +40,7 @@ the various configuration values within a running CouchDB instance.

.. code-block:: http

GET /_config HTTP/1.1
GET /_node/nonode@nohost/_config HTTP/1.1
Accept: application/json
Host: localhost:5984

Expand Down Expand Up @@ -152,12 +152,15 @@ the various configuration values within a running CouchDB instance.
}
}

.. versionchanged: 2.0.0 The config endpoint from ``/_config`` to
``/_node/{node-name}/_config``.

.. _api/config/section:

``/_config/section``
====================
``_node/{node-name}/_config/section``
=====================================

.. http:get:: /_config/{section}
.. http:get:: /_node/{node-name}/_config/{section}
:synopsis: Returns all the configuration values for the specified section

Gets the configuration structure for a single section.
Expand All @@ -174,7 +177,7 @@ the various configuration values within a running CouchDB instance.

.. code-block:: http

GET /_config/httpd HTTP/1.1
GET /_node/nonode@nohost/_config/httpd HTTP/1.1
Accept: application/json
Host: localhost:5984

Expand Down Expand Up @@ -203,10 +206,10 @@ the various configuration values within a running CouchDB instance.

.. _api/config/section/key:

``/_config/section/key``
========================
``/_node/node/_config/section/key``
===================================

.. http:get:: /_config/{section}/{key}
.. http:get:: /_node/{node-name}/_config/{section}/{key}
:synopsis: Returns a specific section/configuration value

Gets a single configuration value from within a specific configuration
Expand All @@ -225,7 +228,7 @@ the various configuration values within a running CouchDB instance.

.. code-block:: http

GET /_config/log/level HTTP/1.1
GET /_node/nonode@nohost/_config/log/level HTTP/1.1
Accept: application/json
Host: localhost:5984

Expand All @@ -247,7 +250,7 @@ the various configuration values within a running CouchDB instance.
or numeric value, or an array or object. Some client environments may
not parse simple strings or numeric values as valid JSON.

.. http:put:: /_config/{section}/{key}
.. http:put:: /_node/{node-name}/_config/{section}/{key}
:synopsis: Sets the specified configuration value

Updates a configuration value. The new value should be supplied in the
Expand All @@ -271,7 +274,7 @@ the various configuration values within a running CouchDB instance.

.. code-block:: http

PUT /_config/log/level HTTP/1.1
PUT /_node/nonode@nohost/_config/log/level HTTP/1.1
Accept: application/json
Content-Length: 7
Content-Type: application/json
Expand All @@ -292,7 +295,7 @@ the various configuration values within a running CouchDB instance.

"debug"

.. http:delete:: /_config/{section}/{key}
.. http:delete:: /_node/{node-name}/_config/{section}/{key}
:synopsis: Removes the current setting

Deletes a configuration value. The returned JSON will be the value of the
Expand All @@ -312,7 +315,7 @@ the various configuration values within a running CouchDB instance.

.. code-block:: http

DELETE /_config/log/level HTTP/1.1
DELETE /_node/nonode@nohost/_config/log/level HTTP/1.1
Accept: application/json
Host: localhost:5984

Expand Down
9 changes: 5 additions & 4 deletions src/config/auth.rst
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,13 @@ Server Administrators
CouchDB is restarted, the passwords will be salted and encrypted. You may
also use the HTTP interface to create administrator accounts; this way,
you don't need to restart CouchDB, and there's no need to temporarily store
or transmit passwords in plaintext. The HTTP ``_config/admins`` endpoint
supports querying, deleting or creating new admin accounts:
or transmit passwords in plaintext. The HTTP
``/_node/{node-name}/_config/admins`` endpoint supports querying, deleting
or creating new admin accounts:

.. code-block:: http

GET /_config/admins HTTP/1.1
GET /_node/nonode@nohost/_config/admins HTTP/1.1
Accept: application/json
Host: localhost:5984

Expand All @@ -74,7 +75,7 @@ Server Administrators

.. code-block:: http

PUT /_config/admins/architect?raw=true HTTP/1.1
PUT /_node/nonode@nohost/_config/admins/architect?raw=true HTTP/1.1
Accept: application/json
Content-Type: application/json
Content-Length: 89
Expand Down
4 changes: 2 additions & 2 deletions src/config/intro.rst
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ Alternatively, configuration parameters could be set via the
:ref:`HTTP API <api/config>`. This API allows to change CouchDB configuration
on-the-fly without requiring a server restart::

curl -X PUT http://localhost:5984/_config/uuids/algorithm -d '"random"'
curl -X PUT http://localhost:5984/_node/nonode@nohost/_config/uuids/algorithm -d '"random"'

In the response the old parameter's value returns::

Expand All @@ -166,7 +166,7 @@ You should be careful with changing configuration via the HTTP API since it's
easy to make CouchDB unavailable. For instance, if you'd like to change the
:option:`httpd/bind_address` for a new one::

curl -X PUT http://localhost:5984/_config/httpd/bind_address -d '"10.10.0.128"'
curl -X PUT http://localhost:5984/_node/nonode@nohost/_config/httpd/bind_address -d '"10.10.0.128"'

However, if you make a typo, or the specified IP address is not available
from your network, CouchDB will be unavailable for you in both cases and
Expand Down
13 changes: 8 additions & 5 deletions src/intro/security.rst
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,10 @@ identification for certain requests:
- Triggering compaction (:post:`POST /database/_compact </{db}/_compact>`)
- Reading the task status list (:get:`GET /_active_tasks </_active_tasks>`)
- Restarting the server (:post:`POST /_restart </_restart>`)
- Reading the active configuration (:get:`GET /_config </_config>`)
- Updating the active configuration (:put:`PUT /_config/section/key
</_config/{section}/{key}>`)
- Reading the active configuration
(:get:`GET /_node/{node-name}/_config </_config>`)
- Updating the active configuration
(:put:`PUT /_node/{node-name}/_config/section/key </_config/{section}/{key}>`)

Creating New Admin User
^^^^^^^^^^^^^^^^^^^^^^^
Expand All @@ -90,7 +91,7 @@ create an admin user. We'll call her ``anna``, and her password is ``secret``.
Note the double quotes in the following code; they are needed to denote a string
value for the :ref:`configuration API <api/config>`::

> curl -X PUT $HOST/_config/admins/anna -d '"secret"'
> curl -X PUT $HOST/_node/$NODENAME/_config/admins/anna -d '"secret"'
""

As per the :ref:`_config <api/config>` API's behavior, we're getting
Expand Down Expand Up @@ -470,7 +471,9 @@ Now let's share the field ``name``. First, set up the ``public_fields``
configuration option. Remember, that this action requires administrator
privileges. The next command will prompt you for user `admin`'s password:

curl -X PUT http://localhost:5984/_config/couch_httpd_auth/public_fields \
.. code-block:: bash

curl -X PUT http://localhost:5984/_node/nonode@nohost/_config/couch_httpd_auth/public_fields \
-H "Content-Type: application/json" \
-d '"name"' \
-u admin
Expand Down
2 changes: 2 additions & 0 deletions src/whatsnew/2.0.rst
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@ Version 2.0.0
* Support added for Erlang/OTP 17.x, 18.x and 19
* New streamlined build system written for Unix-like systems and Microsoft
Windows
* :ref:`Configuration <api/config>` has moved from ``/_config`` to
``/_node/{node-name}/_config``

.. _release/2.0.x/upgrade:

Expand Down