Apache CouchDB is an open-source database. Unlike other databases, it stores data in JSON documents instead of tables. Each of these documents is a separate entity and has its own schema.
The CouchDB database has a REST API which allows you to work with the database's JSON documents. With this API, you can create your own requests right in ReadyAPI to work with JSON documents inside the database and get the necessary data from the CouchDB server.
To learn more about specifics of the CouchDB API, see the CouchDB documentation. You can also check the detailed description of CouchDB responses and possible HTTP status codes.
Creating a Database Record – Example
You can use ReadyAPI to create new CouchDB database records with the CouchDB API.
This example describes how to work with a fresh installation of a CouchDB database. To learn how to install it, see the CouchDB documentation.
-
Create a new CouchDB database. For this example, name it
sample
. -
Create a new ReadyAPI project. To do that, select File > New Functional Test.
-
Select Endpoint.
-
Click Next.
-
Enter the database URI in the following order:
<CouchDB URI>/<Database name>
-
Select the POST method for the new request.
-
ReadyAPI will suggest running the test or creating a data-driven test. You do not need these options now, so close the dialog.
-
Open the REST Request test step.
-
Make sure to select the
application/json
Media Type. -
Create a request payload. Set the
Sample
field and theData
value. -
To send the request, click Send.
ReadyAPI will send a request to CouchDB, and it will create a new document with the data you sent.