A newer version of this documentation is available.

View Latest

Request with authentication - HTTP header

  • concept
March 23, 2025
+ 12

In this example, the credentials (user="local:tweets", pass="pAss1")are given in the request header using basic authentication.

Request:
$ curl -v http://localhost:8093/query/service \
-d "statement=SELECT text FROM tweets LIMIT 1" \
-u tweets:pAss1
Response:
< HTTP/1.1 200 OK
         {
         "requestID": "11ed1981-7802-4fc2-acd6-dfcd1c05a288",
         "signature": {
         "text": "json"
         },
         "results": [
         {
         "text": "Couchbase is my favorite database"
         }
         ],
         "status": "success",
         "metrics": {
         "elapsedTime": "3.455608ms",
         "executionTime": "3.116241ms",
         "resultCount": 1,
         "resultSize": 65,
         "mutationCount": 0,
         "errorCount": 0,
         "warningCount": 0
         }
         }
         $