{"id":10339,"date":"2023-12-07T06:52:38","date_gmt":"2023-12-07T14:52:38","guid":{"rendered":"https:\/\/www.couchbase.com\/developers\/tutorials\/quickstart-flask-python\/"},"modified":"2023-12-07T06:52:38","modified_gmt":"2023-12-07T14:52:38","slug":"quickstart-flask-python","status":"publish","type":"tutorials","link":"https:\/\/www.couchbase.com\/it\/developers\/tutorials\/quickstart-flask-python\/","title":{"rendered":"Quickstart in Couchbase with Python and Flask"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">In this tutorial, you will learn how to connect to a Couchbase Capella cluster to create, read, update, and delete documents and how to write simple parametrized SQL++ queries.<\/p>\n\n\n\n<h3 id=\"h-prerequisites\" class=\"wp-block-heading\">Prerequisites<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">To run this prebuilt project, you will need:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\n<p><a href=\"https:\/\/www.couchbase.com\/products\/capella\/\">Couchbase Capella<\/a> cluster with <a href=\"https:\/\/docs.couchbase.com\/python-sdk\/current\/ref\/travel-app-data-model.html\">travel-sample<\/a> bucket loaded.<\/p>\n<ul>\n<li>To run this tutorial using a self managed Couchbase cluster, please refer to the <a href=\"#running-self-managed-couchbase-cluster\">appendix<\/a>.<\/li>\n<\/ul>\n<\/li>\n\n\n<li>\n<p><a href=\"https:\/\/www.python.org\/downloads\/\">Python<\/a> 3.9 or higher installed<\/p>\n<ul>\n<li>Ensure that the Python version is <a href=\"https:\/\/docs.couchbase.com\/python-sdk\/current\/project-docs\/compatibility.html#python-version-compat\">compatible<\/a> with the Couchbase SDK.<\/li>\n<\/ul>\n<\/li>\n\n\n<li>\n<p>Loading Travel Sample Bucket\nIf travel-sample is not loaded in your Capella cluster, you can load it by following the instructions for your Capella Cluster:<\/p>\n<ul>\n<li><a href=\"https:\/\/docs.couchbase.com\/cloud\/clusters\/data-service\/import-data-documents.html#import-sample-data\">Load travel-sample bucket in Couchbase Capella<\/a><\/li>\n<\/ul>\n<\/li>\n\n<\/ul>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p class=\"wp-block-paragraph\">Note that this tutorial is designed to work with the latest Python SDK (4.x) for Couchbase. It will not work with the older Python SDK for Couchbase without adapting the code.<\/p>\n<\/blockquote>\n\n\n\n<h4 id=\"h-couchbase-capella-configuration\" class=\"wp-block-heading\">Couchbase Capella Configuration<\/h4>\n\n\n\n<p class=\"wp-block-paragraph\">When running Couchbase using <a href=\"https:\/\/cloud.couchbase.com\/\">Capella<\/a>, the following prerequisites need to be met.<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>The application requires the travel-sample bucket to be <a href=\"https:\/\/docs.couchbase.com\/cloud\/clusters\/data-service\/import-data-documents.html#import-sample-data\">loaded<\/a> in the cluster from the Capella UI.<\/li>\n\n\n<li>Create the <a href=\"https:\/\/docs.couchbase.com\/cloud\/clusters\/manage-database-users.html\">database credentials<\/a> to access the travel-sample bucket (Read and Write) used in the application.<\/li>\n\n\n<li><a href=\"https:\/\/docs.couchbase.com\/cloud\/clusters\/allow-ip-address.html\">Allow access<\/a> to the Cluster from the IP on which the application is running.<\/li>\n\n<\/ul>\n\n\n\n<h3 id=\"h-app-setup\" class=\"wp-block-heading\">App Setup<\/h3>\n\n\n\n<h4 id=\"h-cloning-repo\" class=\"wp-block-heading\">Cloning Repo<\/h4>\n\n\n\n<pre class=\"wp-block-code language-shell\"><code>git clone https:\/\/github.com\/couchbase-examples\/python-quickstart.git\n<\/code><\/pre>\n\n\n\n<h4 id=\"h-install-dependencies\" class=\"wp-block-heading\">Install Dependencies<\/h4>\n\n\n\n<p class=\"wp-block-paragraph\">The dependencies for the application are specified in the <code>requirements.txt<\/code> file in the source folder. Dependencies can be installed through <code>pip<\/code> the default package manager for Python.<\/p>\n\n\n\n<pre class=\"wp-block-code language-shell\"><code>python -m pip install -r src\/requirements.txt\n<\/code><\/pre>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p class=\"wp-block-paragraph\">Note: Python SDKs older than version 4.1.9 require OpenSSL v1.1. This might not be the default in some newer platforms. In such scenarios, please install the SDK without using the prebuilt wheels<\/p>\n<\/blockquote>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p class=\"wp-block-paragraph\"><code>python -m pip install couchbase --no-binary couchbase<\/code><\/p>\n<\/blockquote>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p class=\"wp-block-paragraph\">Refer to the <a href=\"https:\/\/github.com\/couchbase\/couchbase-python-client#alternative-installation-methods\">instructions in the SDK<\/a> for more info.<\/p>\n<\/blockquote>\n\n\n\n<h4 id=\"h-setup-database-configuration\" class=\"wp-block-heading\">Setup Database Configuration<\/h4>\n\n\n\n<p class=\"wp-block-paragraph\">To know more about connecting to your Capella cluster, please follow the <a href=\"https:\/\/docs.couchbase.com\/cloud\/get-started\/connect.html\">instructions<\/a>.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Specifically, you need to do the following:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Create the <a href=\"https:\/\/docs.couchbase.com\/cloud\/clusters\/manage-database-users.html\">database credentials<\/a> to access the travel-sample bucket (Read and Write) used in the application.<\/li>\n\n\n<li><a href=\"https:\/\/docs.couchbase.com\/cloud\/clusters\/allow-ip-address.html\">Allow access<\/a> to the Cluster from the IP on which the application is running.<\/li>\n\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">All configuration for communication with the database is fetched from the environment variables. We have provided a convenience feature in this quickstart to read the environment variables from a local file, <code>.env<\/code> in the source folder.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Create a copy of <code>.env.example<\/code> file &amp; rename it to <code>.env<\/code> &amp; add the values for the Couchbase cluster.<\/p>\n\n\n\n<pre class=\"wp-block-code language-sh\"><code>DB_CONN_STR=&lt;connection_string&gt;\nDB_USERNAME=&lt;user_with_read_write_permission_to_travel-sample_bucket&gt;\nDB_PASSWORD=&lt;password_for_user&gt;\n<\/code><\/pre>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p class=\"wp-block-paragraph\">Note: The connection string expects the <code>couchbases:\/\/<\/code> or <code>couchbase:\/\/<\/code> part.<\/p>\n<\/blockquote>\n\n\n\n<h3 id=\"h-running-the-application\" class=\"wp-block-heading\">Running the Application<\/h3>\n\n\n\n<h4 id=\"h-directly-on-local-machine\" class=\"wp-block-heading\">Directly on Local Machine<\/h4>\n\n\n\n<p class=\"wp-block-paragraph\">At this point, we have installed the dependencies, loaded the travel-sample data and configured the application with the credentials. The application is now ready and you can run it.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The application will run on port 8080 of your local machine (<a href=\"http:\/\/localhost:8080\">http:\/\/localhost:8080<\/a>). You will find the Swagger documentation of the API which you can use to try the API endpoints.<\/p>\n\n\n\n<pre class=\"wp-block-code language-shell\"><code>cd src\npython app.py\n<\/code><\/pre>\n\n\n\n<h4 id=\"h-using-docker\" class=\"wp-block-heading\">Using Docker<\/h4>\n\n\n\n<p class=\"wp-block-paragraph\">If you prefer to run this quick start using Docker, we have provided the Dockerfile which you can use to build the image and run the API as a container.<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Build the Docker image<\/li>\n\n<\/ul>\n\n\n\n<pre class=\"wp-block-code language-sh\"><code>cd src\ndocker build -t couchbase-flask-quickstart .\n<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Run the Docker image<\/li>\n\n<\/ul>\n\n\n\n<pre class=\"wp-block-code language-sh\"><code>docker run -it --env-file .env -p 8080:8080 couchbase-flask-quickstart\n<\/code><\/pre>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p class=\"wp-block-paragraph\">Note: The <code>.env<\/code> file has the connection information to connect to your Capella cluster. With the <code>--env-file<\/code>, docker will inject those environment variables to the container.<\/p>\n<\/blockquote>\n\n\n\n<p class=\"wp-block-paragraph\">Once the app is up and running, you can launch your browser and go to the <a href=\"https:\/\/localhost:8080\/\">Swagger documentation<\/a> to test the APIs.<\/p>\n\n\n\n<h4 id=\"h-verifying-the-application\" class=\"wp-block-heading\">Verifying the Application<\/h4>\n\n\n\n<p class=\"wp-block-paragraph\">Once the application starts, you can see the details of the application on the logs.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><img decoding=\"async\" src=\"app_startup.png\" alt=\"Application Startup\"><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The application will run on port 8080 of your local machine (<a href=\"http:\/\/localhost:8080\">http:\/\/localhost:8080<\/a>). You will find the interactive Swagger documentation of the API if you go to the URL in your browser. Swagger documentation is used in this demo to showcase the different API end points and how they can be invoked. More details on the Swagger documentation can be found in the <a href=\"#swagger-documentation\">appendix<\/a>.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><img decoding=\"async\" src=\"swagger_documentation.png\" alt=\"Swagger Documentation\"><\/p>\n\n\n\n<h3 id=\"h-data-model\" class=\"wp-block-heading\">Data Model<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">For this tutorial, we use three collections, <code>airport<\/code>, <code>airline<\/code> and <code>route<\/code> that contain sample airports, airlines and airline routes respectively. The route collection connects the airports and airlines as seen in the figure below. We use these connections in the quickstart to generate airports that are directly connected and airlines connecting to a destination airport. Note that these are just examples to highlight how you can use SQL++ queries to join the collections.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><img decoding=\"async\" src=\"travel_sample_data_model.png\" alt=\"img\"><\/p>\n\n\n\n<h3 id=\"h-let-us-review-the-code\" class=\"wp-block-heading\">Let Us Review the Code<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">To begin this tutorial, clone the repo and open it up in the IDE of your choice. Now you can learn about how to create, read, update and delete documents in Couchbase Server.<\/p>\n\n\n\n<h4 id=\"h-code-layout\" class=\"wp-block-heading\">Code Layout<\/h4>\n\n\n\n<pre class=\"wp-block-code\"><code>\u251c\u2500\u2500 src\n\u2502   \u251c\u2500\u2500 Dockerfile\n\u2502   \u251c\u2500\u2500 api\n\u2502   \u2502   \u251c\u2500\u2500 airline.py\n\u2502   \u2502   \u251c\u2500\u2500 airport.py\n\u2502   \u2502   \u2514\u2500\u2500 route.py\n\u2502   \u251c\u2500\u2500 app.py\n\u2502   \u251c\u2500\u2500 db.py\n\u2502   \u251c\u2500\u2500 extensions.py\n\u2502   \u251c\u2500\u2500 requirements.txt\n\u2502   \u2514\u2500\u2500 tests\n\u2502       \u251c\u2500\u2500 conftest.py\n\u2502       \u251c\u2500\u2500 test_airline.py\n\u2502       \u251c\u2500\u2500 test_airport.py\n\u2502       \u2514\u2500\u2500 test_route.py\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">We have separated out the API code into separate files by the entity (collection) in the <code>api<\/code> folder. The tests are similarly separated out by entity in the <code>tests<\/code> folder.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">In <code>app.py<\/code>, we initialize the application including connecting to the database and add all the routes from individual API files.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">We have the Couchbase SDK operations defined in the <code>CouchbaseClient<\/code> class inside the <code>db.py<\/code> file.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">We recommend creating a single Couchbase connection when your application starts up, and sharing this instance throughout your application. If you know at startup time which buckets, scopes, and collections your application will use, we recommend obtaining them from the Cluster at startup time and sharing those instances throughout your application as well.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">In this application, we have created the connection object in <code>extensions.py<\/code> and we use this object in all of our APIs. The object is initialized in <code>app.py<\/code>. We have also stored the reference to our bucket, <code>travel-sample<\/code> and the scope, <code>inventory<\/code> in the connection object.<\/p>\n\n\n\n<pre class=\"wp-block-code language-python\"><code># app.py\nfrom extensions import couchbase_db\n\n...\n\n# Create the database connection\ncouchbase_db.init_app(conn_str, username, password, app)\ncouchbase_db.connect()\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">The Couchbase connection is established in the <code>connect<\/code> method defined in <code>db.py<\/code>. There, we call the <a href=\"https:\/\/docs.couchbase.com\/sdk-api\/couchbase-python-client\/couchbase_api\/couchbase_core.html#couchbase.cluster.Cluster\"><code>Cluster<\/code><\/a> method defined in the SDK to create the Database connection. If the connection is already established, we do not do anything. In our application, we have the same bucket and scope that is used by all the APIs. The collection will change depending on the API route.<\/p>\n\n\n\n<pre class=\"wp-block-code language-python\"><code># db.py\n# authentication for Couchbase cluster\nauth = PasswordAuthenticator(self.username, self.password)\n\ncluster_opts = ClusterOptions(auth)\n# wan_development is used to avoid latency issues while connecting to Couchbase over the internet\ncluster_opts.apply_profile(&quot;wan_development&quot;)\n\n# connect to the cluster\nself.cluster = Cluster(self.conn_str, cluster_opts)\n\n# wait until the cluster is ready for use\nself.cluster.wait_until_ready(timedelta(seconds=5))\n\n# get a reference to our bucket\nself.bucket = self.cluster.bucket(self.bucket_name)\n\n# get a reference to our scope\nself.scope = self.bucket.scope(self.scope_name)\n<\/code><\/pre>\n\n\n\n<h4 id=\"h-airport-entity\" class=\"wp-block-heading\">Airport Entity<\/h4>\n\n\n\n<p class=\"wp-block-paragraph\">For this tutorial, we will focus on the airline entity. The other entities are similar.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">We will be setting up a REST API to manage airport documents.<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"#post-airport\">POST Airport<\/a> \u2013 Create a new airport<\/li>\n\n\n<li><a href=\"#get-airport\">GET Airport<\/a> \u2013 Read specified airport<\/li>\n\n\n<li><a href=\"#put-airport\">PUT Airport<\/a> \u2013 Update specified airport<\/li>\n\n\n<li><a href=\"#delete-airport\">DELETE Airport<\/a> \u2013 Delete airport<\/li>\n\n\n<li><a href=\"#list-airport\">Airport List<\/a> \u2013 Get all airports. Optionally filter the list by country<\/li>\n\n\n<li><a href=\"#direct-connections\">Direct Connections<\/a> &#8211; Get a list of airports directly connected to the specified airport<\/li>\n\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">For CRUD operations, we will use the <a href=\"https:\/\/docs.couchbase.com\/python-sdk\/current\/howtos\/kv-operations.html\">Key-Value operations<\/a> that are built into the Couchbase SDK to create, read, update, and delete a document. Every document will need an ID (similar to a primary key in other databases) to save it to the database. This ID is passed in the URL. For other end points, we will use <a href=\"https:\/\/docs.couchbase.com\/python-sdk\/current\/howtos\/n1ql-queries-with-sdk.html\">SQL++<\/a> to query for documents.<\/p>\n\n\n\n<h4 id=\"h-airport-document-structure\" class=\"wp-block-heading\">Airport Document Structure<\/h4>\n\n\n\n<p class=\"wp-block-paragraph\">Our profile document will have an airportname, city, country, faa code, icao code, timezone info and the geographic coordinates. For this demo, we will store all airport information in one document in the <code>airport<\/code> collection in the <code>travel-sample<\/code> bucket.<\/p>\n\n\n\n<pre class=\"wp-block-code language-json\"><code>{\n  &quot;airportname&quot;: &quot;Sample Airport&quot;,\n  &quot;city&quot;: &quot;Sample City&quot;,\n  &quot;country&quot;: &quot;United Kingdom&quot;,\n  &quot;faa&quot;: &quot;SAA&quot;,\n  &quot;icao&quot;: &quot;SAAA&quot;,\n  &quot;tz&quot;: &quot;Europe\/Paris&quot;,\n  &quot;geo&quot;: {\n    &quot;lat&quot;: 48.864716,\n    &quot;lon&quot;: 2.349014,\n    &quot;alt&quot;: 92\n  }\n}\n<\/code><\/pre>\n\n\n\n<h4 id=\"h-post-airport\" class=\"wp-block-heading\">POST Airport<\/h4>\n\n\n\n<p class=\"wp-block-paragraph\">Open the <code>airport.py<\/code> file and navigate to the <code>post<\/code> method in the <code>AirportId<\/code> class. We make a reference of the json data to a variable <code>data<\/code> that we insert into the database using the datbase client, <code>couchbase_db<\/code>.<\/p>\n\n\n\n<pre class=\"wp-block-code language-python\"><code># post method in class AirportId of airport.py\ndata = request.json\ncouchbase_db.insert_document(AIRPORT_COLLECTION, key=id, doc=data)\nreturn data, 201\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">We call the <code>insert_document<\/code> method in CouchbaseClient class, which calls the <a href=\"https:\/\/docs.couchbase.com\/sdk-api\/couchbase-python-client\/couchbase_api\/couchbase_core.html#couchbase.collection.Collection.insert\"><code>insert<\/code><\/a> method for the collection defined in the Couchbase SDK. The insert method takes the key (ID) by which the document is referenced and the content to be inserted into the collection.<\/p>\n\n\n\n<pre class=\"wp-block-code language-python\"><code># CouchbaseClient class in db.py\ndef insert_document(self, collection_name: str, key: str, doc: dict):\n  &quot;&quot;&quot;Insert document using KV operation&quot;&quot;&quot;\n  return self.scope.collection(collection_name).insert(key, doc)\n<\/code><\/pre>\n\n\n\n<h4 id=\"h-get-airport\" class=\"wp-block-heading\">GET Airport<\/h4>\n\n\n\n<p class=\"wp-block-paragraph\">Navigate to the <code>get<\/code> method of the <code>AirportId<\/code> class in the <code>airport.py<\/code> file. We only need the airport document ID or our key from the user to retrieve a particular airport document using a key-value operation which is passed in the get_document method. The result is converted into a python dictionary using the <code>.content_as[dict]<\/code> operation defined for the result returned by the SDK.<\/p>\n\n\n\n<pre class=\"wp-block-code language-python\"><code># get method in class AirportId of airport.py\nresult = couchbase_db.get_document(AIRPORT_COLLECTION, key=id)\nreturn result.content_as[dict]\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">The CouchbaseClient client <code>get_document<\/code> method calls the <a href=\"https:\/\/docs.couchbase.com\/sdk-api\/couchbase-python-client\/couchbase_api\/couchbase_core.html#couchbase.collection.Collection.get\"><code>get<\/code><\/a> method defined for collections in the Couchbase SDK. We fetch the documents based on the key by which it is stored.<\/p>\n\n\n\n<pre class=\"wp-block-code language-python\"><code># CouchbaseClient class in db.py\ndef get_document(self, collection_name: str, key: str):\n  &quot;&quot;&quot;Get document by key using KV operation&quot;&quot;&quot;\n  return self.scope.collection(collection_name).get(key)\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">If the document is not found in the database, we get an exception, <code>DocumentNotFoundException<\/code> from the SDK and return the status as 404.<\/p>\n\n\n\n<h4 id=\"h-put-airport\" class=\"wp-block-heading\">PUT Airport<\/h4>\n\n\n\n<p class=\"wp-block-paragraph\">Update an Airport by Document ID<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">We use the ID value passed in via the URL to call the <code>upsert_document<\/code> method in CouchbaseClient passing it the key and the data provided in the request body using request.json.<\/p>\n\n\n\n<pre class=\"wp-block-code language-python\"><code># put method in class AirportId of airport.py\nupdated_doc = request.json\ncouchbase_db.upsert_document(AIRPORT_COLLECTION, key=id, doc=updated_doc)\nreturn updated_doc\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">The CouchbaseClient class <code>upsert_document<\/code> method calls the <a href=\"https:\/\/docs.couchbase.com\/sdk-api\/couchbase-python-client\/couchbase_api\/couchbase_core.html#couchbase.collection.Collection.upsert\"><code>upsert<\/code><\/a> method defined for collection in the Couchbase SDK with the key and json data to update the document in the database.<\/p>\n\n\n\n<pre class=\"wp-block-code language-python\"><code># CouchbaseClient class in db.py\ndef upsert_document(self, collection_name: str, key: str, doc: dict):\n  &quot;&quot;&quot;Upsert document using KV operation&quot;&quot;&quot;\n  return self.scope.collection(collection_name).upsert(key, doc)\n<\/code><\/pre>\n\n\n\n<h4 id=\"h-delete-airport\" class=\"wp-block-heading\">DELETE Airport<\/h4>\n\n\n\n<p class=\"wp-block-paragraph\">Navigate to the <code>delete<\/code> function in <code>airport.py<\/code>. We only need the key or document ID from the user to delete a document using the key-value operation.<\/p>\n\n\n\n<pre class=\"wp-block-code language-python\"><code># delete method in class AirportId of airport.py\ncouchbase_db.delete_document(AIRPORT_COLLECTION, key=id)\nreturn &quot;Deleted&quot;, 204\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">The <code>delete_document<\/code> method in CouchbaseClient class calls the <a href=\"https:\/\/docs.couchbase.com\/sdk-api\/couchbase-python-client\/couchbase_api\/couchbase_core.html#couchbase.collection.Collection.remove\"><code>remove<\/code><\/a> method defined for collection in the Couchbase SDK sending the key of the document to remove from the database.<\/p>\n\n\n\n<pre class=\"wp-block-code language-python\"><code># CouchbaseClient class in db.py\ndef delete_document(self, collection_name: str, key: str):\n    &quot;&quot;&quot;Delete document using KV operation&quot;&quot;&quot;\n    return self.scope.collection(collection_name).remove(key)\n<\/code><\/pre>\n\n\n\n<h4 id=\"h-list-airport\" class=\"wp-block-heading\">List Airport<\/h4>\n\n\n\n<p class=\"wp-block-paragraph\">This endpoint retrieves the list of airports in the database. The API has options to specify the page size for the results and country from which to fetch the airport documents.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><a href=\"https:\/\/docs.couchbase.com\/python-sdk\/current\/howtos\/n1ql-queries-with-sdk.html\">SQL++<\/a> is a powerful query language based on SQL, but designed for structured and flexible JSON documents. We will use a SQL+ query to search for airports with Limit, Offset, and Country option.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Navigate to the <code>get<\/code> method in the <code>AirportList<\/code> class of <code>airport.py<\/code> file. This endpoint is different from the others we have seen before because it makes the SQL++ query rather than a key-value operation. This usually means more overhead because the query engine is involved. For this query, we are using the predefined indices in the <code>travel-sample<\/code> bucket. We can create an additional <a href=\"https:\/\/docs.couchbase.com\/server\/current\/learn\/services-and-indexes\/indexes\/indexing-and-query-perf.html\">index<\/a> specific for this query to make it perform better.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">First, we need to get the values from the query string for country, limit, and Offset that we will use in our query. These are pulled from the <code>request.args.get<\/code> method.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">This end point has two queries depending on the value for the country parameter. If a country name is specified, we retrieve the airport documents for that specific country. If it is not specified, we retrieve the list of airports across all countries. The queries are slightly different for these two scenarios.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">We build our SQL++ query using the <a href=\"https:\/\/docs.couchbase.com\/python-sdk\/current\/howtos\/n1ql-queries-with-sdk.html#queries-placeholders\">parameters<\/a> specified by <code>$<\/code> symbol for both these scenarios. The difference between the two queries is the presence of the <code>country<\/code> parameter in the query. Normally for the queries with pagination, it is advised to order the results to maintain the order of results across multiple queries.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Next, we pass that <code>query<\/code> to the CouchbaseClient class <code>query<\/code> method. We save the results in a list, <code>airports<\/code>. By default, the Python SDK will <a href=\"https:\/\/docs.couchbase.com\/python-sdk\/current\/howtos\/n1ql-queries-with-sdk.html#streaming-large-result-sets\">stream result set from the server<\/a>. To gather all the results, we need to iterate over the results.<\/p>\n\n\n\n<pre class=\"wp-block-code language-python\"><code># get method in AirportList class in airport.py\ncountry = request.args.get(&quot;country&quot;, &quot;&quot;)\nlimit = int(request.args.get(&quot;limit&quot;, 10))\noffset = int(request.args.get(&quot;offset&quot;, 0))\n\n# create query\nif country:\n    query = &quot;&quot;&quot;\n        SELECT airport.airportname,\n            airport.city,\n            airport.country,\n            airport.faa,\n            airport.geo,\n            airport.icao,\n            airport.tz\n        FROM airport AS airport\n        WHERE airport.country = $country\n        ORDER BY airport.airportname\n        LIMIT $limit\n        OFFSET $offset;\n    &quot;&quot;&quot;\nelse:\n    query = &quot;&quot;&quot;\n        SELECT airport.airportname,\n            airport.city,\n            airport.country,\n            airport.faa,\n            airport.geo,\n            airport.icao,\n            airport.tz\n        FROM airport AS airport\n        ORDER BY airport.airportname\n        LIMIT $limit\n        OFFSET $offset;\n    &quot;&quot;&quot;\n\n# run query\nresults = couchbase_db.query(\n            query, country=country, limit=limit, offset=offset\n          )\n# gather all documents\nairports = [r for r in results]\nreturn airports\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">The <code>query<\/code> method in the CouchbaseClient class executes the SQL++ query using the <a href=\"https:\/\/docs.couchbase.com\/sdk-api\/couchbase-python-client\/couchbase_api\/couchbase_core.html#couchbase.scope.Scope.query\"><code>query<\/code><\/a> method defined in the <a href=\"https:\/\/docs.couchbase.com\/python-sdk\/current\/howtos\/n1ql-queries-with-sdk.html#querying-at-scope-level\">Scope<\/a> by the Couchbase SDK.<\/p>\n\n\n\n<pre class=\"wp-block-code language-python\"><code># CouchbaseClient class in db.py\ndef query(self, sql_query, *options, **kwargs):\n  &quot;&quot;&quot;Query Couchbase using SQL++&quot;&quot;&quot;\n  # options are used for positional parameters\n  # kwargs are used for named parameters\n  return self.scope.query(sql_query, *options, **kwargs)\n<\/code><\/pre>\n\n\n\n<h4 id=\"h-direct-connections\" class=\"wp-block-heading\">Direct Connections<\/h4>\n\n\n\n<p class=\"wp-block-paragraph\">This endpoint fetches the airports that can be reached directly from the specified source airport code. This also uses a SQL++ query to fetch the results simlar to the List Airport endpoint.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Let us look at the query used here:<\/p>\n\n\n\n<pre class=\"wp-block-code language-sql\"><code>SELECT distinct (route.destinationairport)\nFROM airport as airport\nJOIN route as route on route.sourceairport = airport.faa\nWHERE airport.faa = $airport and route.stops = 0\nORDER BY route.destinationairport\nLIMIT $limit\nOFFSET $offset\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">We are fetching the direct connections by joining the airport collection with the route collection and filtering based on the source airport specified by the user and by routes with no stops.<\/p>\n\n\n\n<h3 id=\"h-running-tests\" class=\"wp-block-heading\">Running Tests<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">We have defined integration tests using <a href=\"https:\/\/docs.pytest.org\/en\/7.4.x\/\">pytest<\/a> for all the API end points. The integration tests use the same database configuration as the application. For the tests, we perform the operation using the API and confirm the results by checking the documents in the database. For example, to check the creation of the document by the API, we would call the API to create the document and then read the same document directly from the database using the CouchbaseClient and compare them. After the tests, the documents are cleaned up.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The tests including the fixtures and helpers for the tests are configured in the <code>conftest.py<\/code> file in the tests folder.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">To run the tests, use the following commands:<\/p>\n\n\n\n<pre class=\"wp-block-code language-bash\"><code>cd src\npython -m pytest\n<\/code><\/pre>\n\n\n\n<h3 id=\"h-appendix\" class=\"wp-block-heading\">Appendix<\/h3>\n\n\n\n<h4 id=\"h-extending-api-by-adding-new-entity\" class=\"wp-block-heading\">Extending API by Adding New Entity<\/h4>\n\n\n\n<p class=\"wp-block-paragraph\">If you would like to add another entity to the APIs, these are the steps to follow:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Create the new entity (collection) in the Couchbase bucket. You can create the collection using the <a href=\"https:\/\/docs.couchbase.com\/sdk-api\/couchbase-python-client\/couchbase_api\/couchbase_management.html#couchbase.management.collections.CollectionManager.create_collection\">SDK<\/a> or via the <a href=\"https:\/\/docs.couchbase.com\/cloud\/n1ql\/n1ql-language-reference\/createcollection.html\">Couchbase Server interface<\/a>.<\/li>\n\n\n<li>Define the routes in a new file in the <code>api<\/code> folder similar to the existing routes like <code>airport.py<\/code>.<\/li>\n\n\n<li>Add the new routes to the application in <code>app.py<\/code>.<\/li>\n\n\n<li>Add the tests for the new routes in a new file in the <code>tests<\/code> folder similar to <code>test_airport.py<\/code>.<\/li>\n\n<\/ul>\n\n\n\n<h4 id=\"h-running-self-managed-couchbase-cluster\" class=\"wp-block-heading\">Running Self Managed Couchbase Cluster<\/h4>\n\n\n\n<p class=\"wp-block-paragraph\">If you are running this quickstart with a self managed Couchbase cluster, you need to <a href=\"https:\/\/docs.couchbase.com\/server\/current\/manage\/manage-settings\/install-sample-buckets.html\">load<\/a> the travel-sample data bucket in your cluster and generate the credentials for the bucket.<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Follow <a href=\"\/tutorial-couchbase-installation-options\">Couchbase Installation Options<\/a> for installing the latest Couchbase Database Server Instance.<\/li>\n\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">You need to update the connection string and the credentials in the <code>.env<\/code> file in the source folder.<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p class=\"wp-block-paragraph\">Note: Couchbase Server must be installed and running prior to running the Flask Python app.<\/p>\n<\/blockquote>\n\n\n\n<h4 id=\"h-swagger-documentation\" class=\"wp-block-heading\">Swagger Documentation<\/h4>\n\n\n\n<p class=\"wp-block-paragraph\">Swagger documentation provides a clear view of the API including endpoints, HTTP methods, request parameters, and response objects.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Click on an individual endpoint to expand it and see detailed information. This includes the endpoint&#8217;s description, possible response status codes, and the request parameters it accepts.<\/p>\n\n\n\n<h5 id=\"h-trying-out-the-api\" class=\"wp-block-heading\">Trying Out the API<\/h5>\n\n\n\n<p class=\"wp-block-paragraph\">You can try out an API by clicking on the &#8220;Try it out&#8221; button next to the endpoints.<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\n<p>Parameters: If an endpoint requires parameters, Swagger UI provides input boxes for you to fill in. This could include path parameters, query strings, headers, or the body of a POST\/PUT request.<\/p>\n<\/li>\n\n\n<li>\n<p>Execution: Once you&#8217;ve inputted all the necessary parameters, you can click the &#8220;Execute&#8221; button to make a live API call. Swagger UI will send the request to the API and display the response directly in the documentation. This includes the response code, response headers, and response body.<\/p>\n<\/li>\n\n<\/ul>\n\n\n\n<h5 id=\"h-models\" class=\"wp-block-heading\">Models<\/h5>\n\n\n\n<p class=\"wp-block-paragraph\">Swagger documents the structure of request and response bodies using models. These models define the expected data structure using JSON schema and are extremely helpful in understanding what data to send and expect.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In this tutorial, you will learn how to connect to a Couchbase Capella cluster to create, read, update, and delete documents and how to write simple parametrized SQL++ queries. Prerequisites To run this prebuilt project, you will need: Note that this tutorial is designed to work with the latest Python SDK (4.x) for Couchbase. It [&hellip;]<\/p>\n","protected":false},"author":0,"featured_media":0,"menu_order":0,"template":"","meta":{"_acf_changed":false,"inline_featured_image":false,"_acf":"","footnotes":""},"tutorial-languages":[606],"tutorial-tags":[641,546],"tutorial-technologies":[572,548,549],"tutorial-types":[550],"class_list":["post-10339","tutorials","type-tutorials","status-publish","hentry","tutorial-languages-python","tutorial-tags-flask","tutorial-tags-rest-api","tutorial-technologies-index","tutorial-technologies-kv","tutorial-technologies-query","tutorial-types-quickstart"],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v28.8 (Yoast SEO v28.9) - https:\/\/yoast.com\/product\/yoast-seo-premium-wordpress\/ -->\n<title>Quickstart in Couchbase with Python and Flask - Couchbase<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.couchbase.com\/it\/developers\/tutorials\/quickstart-flask-python\/\" \/>\n<meta property=\"og:locale\" content=\"it_IT\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Quickstart in Couchbase with Python and Flask\" \/>\n<meta property=\"og:description\" content=\"In this tutorial, you will learn how to connect to a Couchbase Capella cluster to create, read, update, and delete documents and how to write simple parametrized SQL++ queries. Prerequisites To run this prebuilt project, you will need: Note that this tutorial is designed to work with the latest Python SDK (4.x) for Couchbase. It [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.couchbase.com\/it\/developers\/tutorials\/quickstart-flask-python\/\" \/>\n<meta property=\"og:site_name\" content=\"Couchbase\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/Couchbase\/\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.couchbase.com\/wp-content\/uploads\/2026\/10\/Cloud-2.png\" \/>\n\t<meta property=\"og:image:width\" content=\"2548\" \/>\n\t<meta property=\"og:image:height\" content=\"1171\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:site\" content=\"@couchbase\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"15 minuti\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/it\\\/developers\\\/tutorials\\\/quickstart-flask-python\\\/\",\"url\":\"https:\\\/\\\/www.couchbase.com\\\/it\\\/developers\\\/tutorials\\\/quickstart-flask-python\\\/\",\"name\":\"Quickstart in Couchbase with Python and Flask - Couchbase\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/it\\\/#website\"},\"datePublished\":\"2023-12-07T14:52:38+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/it\\\/developers\\\/tutorials\\\/quickstart-flask-python\\\/#breadcrumb\"},\"inLanguage\":\"it-IT\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.couchbase.com\\\/it\\\/developers\\\/tutorials\\\/quickstart-flask-python\\\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/it\\\/developers\\\/tutorials\\\/quickstart-flask-python\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.couchbase.com\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Quickstart in Couchbase with Python and Flask\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/it\\\/#website\",\"url\":\"https:\\\/\\\/www.couchbase.com\\\/it\\\/\",\"name\":\"Couchbase\",\"description\":\"The Operational Data Platform for AI\u2122\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/it\\\/#organization\"},\"alternateName\":\"Couchbase, Inc.\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.couchbase.com\\\/it\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"it-IT\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/it\\\/#organization\",\"name\":\"Couchbase\",\"alternateName\":\"Couchbase, Inc.\",\"url\":\"https:\\\/\\\/www.couchbase.com\\\/it\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"it-IT\",\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/it\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/www.couchbase.com\\\/wp-content\\\/uploads\\\/2026\\\/11\\\/Couchbase_Logo_Couchbase_Token_Red-1.png\",\"contentUrl\":\"https:\\\/\\\/www.couchbase.com\\\/wp-content\\\/uploads\\\/2026\\\/11\\\/Couchbase_Logo_Couchbase_Token_Red-1.png\",\"width\":1129,\"height\":1129,\"caption\":\"Couchbase\"},\"image\":{\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/it\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/www.facebook.com\\\/Couchbase\\\/\",\"https:\\\/\\\/x.com\\\/couchbase\",\"https:\\\/\\\/www.youtube.com\\\/c\\\/CouchbaseServer\",\"https:\\\/\\\/www.linkedin.com\\\/company\\\/couchbase\\\/\",\"https:\\\/\\\/github.com\\\/couchbase\\\/\",\"https:\\\/\\\/en.wikipedia.org\\\/wiki\\\/Couchbase,_Inc.\"],\"description\":\"Couchbase is a database software company headquartered in San Jose, California, providing an operational data platform for AI used by hundreds of global enterprises.\",\"legalName\":\"Couchbase, Inc.\",\"foundingDate\":\"2011-01-01\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Quickstart in Couchbase with Python and Flask - Couchbase","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.couchbase.com\/it\/developers\/tutorials\/quickstart-flask-python\/","og_locale":"it_IT","og_type":"article","og_title":"Quickstart in Couchbase with Python and Flask","og_description":"In this tutorial, you will learn how to connect to a Couchbase Capella cluster to create, read, update, and delete documents and how to write simple parametrized SQL++ queries. Prerequisites To run this prebuilt project, you will need: Note that this tutorial is designed to work with the latest Python SDK (4.x) for Couchbase. It [&hellip;]","og_url":"https:\/\/www.couchbase.com\/it\/developers\/tutorials\/quickstart-flask-python\/","og_site_name":"Couchbase","article_publisher":"https:\/\/www.facebook.com\/Couchbase\/","og_image":[{"width":2548,"height":1171,"url":"https:\/\/www.couchbase.com\/wp-content\/uploads\/2026\/10\/Cloud-2.png","type":"image\/png"}],"twitter_card":"summary_large_image","twitter_site":"@couchbase","twitter_misc":{"Est. reading time":"15 minuti"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.couchbase.com\/it\/developers\/tutorials\/quickstart-flask-python\/","url":"https:\/\/www.couchbase.com\/it\/developers\/tutorials\/quickstart-flask-python\/","name":"Quickstart in Couchbase with Python and Flask - Couchbase","isPartOf":{"@id":"https:\/\/www.couchbase.com\/it\/#website"},"datePublished":"2023-12-07T14:52:38+00:00","breadcrumb":{"@id":"https:\/\/www.couchbase.com\/it\/developers\/tutorials\/quickstart-flask-python\/#breadcrumb"},"inLanguage":"it-IT","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.couchbase.com\/it\/developers\/tutorials\/quickstart-flask-python\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.couchbase.com\/it\/developers\/tutorials\/quickstart-flask-python\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.couchbase.com\/"},{"@type":"ListItem","position":2,"name":"Quickstart in Couchbase with Python and Flask"}]},{"@type":"WebSite","@id":"https:\/\/www.couchbase.com\/it\/#website","url":"https:\/\/www.couchbase.com\/it\/","name":"Couchbase","description":"The Operational Data Platform for AI\u2122","publisher":{"@id":"https:\/\/www.couchbase.com\/it\/#organization"},"alternateName":"Couchbase, Inc.","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.couchbase.com\/it\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"it-IT"},{"@type":"Organization","@id":"https:\/\/www.couchbase.com\/it\/#organization","name":"Couchbase","alternateName":"Couchbase, Inc.","url":"https:\/\/www.couchbase.com\/it\/","logo":{"@type":"ImageObject","inLanguage":"it-IT","@id":"https:\/\/www.couchbase.com\/it\/#\/schema\/logo\/image\/","url":"https:\/\/www.couchbase.com\/wp-content\/uploads\/2026\/11\/Couchbase_Logo_Couchbase_Token_Red-1.png","contentUrl":"https:\/\/www.couchbase.com\/wp-content\/uploads\/2026\/11\/Couchbase_Logo_Couchbase_Token_Red-1.png","width":1129,"height":1129,"caption":"Couchbase"},"image":{"@id":"https:\/\/www.couchbase.com\/it\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/Couchbase\/","https:\/\/x.com\/couchbase","https:\/\/www.youtube.com\/c\/CouchbaseServer","https:\/\/www.linkedin.com\/company\/couchbase\/","https:\/\/github.com\/couchbase\/","https:\/\/en.wikipedia.org\/wiki\/Couchbase,_Inc."],"description":"Couchbase \u00e8 una societ\u00e0 di software per database con sede a San Jose, in California, che fornisce una piattaforma operativa per i dati utilizzata da centinaia di aziende globali.","legalName":"Couchbase, Inc.","foundingDate":"2011-01-01"}]}},"acf":[],"permalink_manager":null,"_links":{"self":[{"href":"https:\/\/www.couchbase.com\/it\/wp-json\/wp\/v2\/tutorials\/10339","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.couchbase.com\/it\/wp-json\/wp\/v2\/tutorials"}],"about":[{"href":"https:\/\/www.couchbase.com\/it\/wp-json\/wp\/v2\/types\/tutorials"}],"version-history":[{"count":0,"href":"https:\/\/www.couchbase.com\/it\/wp-json\/wp\/v2\/tutorials\/10339\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.couchbase.com\/it\/wp-json\/wp\/v2\/media?parent=10339"}],"wp:term":[{"taxonomy":"tutorial-languages","embeddable":true,"href":"https:\/\/www.couchbase.com\/it\/wp-json\/wp\/v2\/tutorial-languages?post=10339"},{"taxonomy":"tutorial-tags","embeddable":true,"href":"https:\/\/www.couchbase.com\/it\/wp-json\/wp\/v2\/tutorial-tags?post=10339"},{"taxonomy":"tutorial-technologies","embeddable":true,"href":"https:\/\/www.couchbase.com\/it\/wp-json\/wp\/v2\/tutorial-technologies?post=10339"},{"taxonomy":"tutorial-types","embeddable":true,"href":"https:\/\/www.couchbase.com\/it\/wp-json\/wp\/v2\/tutorial-types?post=10339"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}