Details
Description
It has been observed that the document in 6.5 given below statement is not working as mentioned and is getting "msg": "No statement provided".
But works fine after providing the -d 'statement ..' (https://docs.couchbase.com/server/current/analytics/run-query.html)
I am not sure if this is a documentation issue or a regression from earlier versions. If no issue from Analytics REST API, then this should be fixed in the documentation.
Tested on Enterprise Edition 7.0.0 build 2465.
Details
--------
In the documentation:
"For example, you can run the query SELECT "Hello, beer!" AS greeting through curl:
$ curl -u Administrator:password -d 'SELECT "Hello, beer!" AS greeting' http://localhost:8095/analytics/service
The request returns:
{
"requestID": "f1b8451c-f626-46be-b1f8-e9ffc891550b",
"signature": "*",
"results": [
]
,
"status": "success",
"metrics":
}
"
Actual result:
jmunta-mac:cbtest jagadeshmunta$ curl -u Administrator:password -d 'SELECT "Hello, beer!" AS greeting' http://172.23.136.145:8095/analytics/service
{
"requestID": "90b410d6-0c48-4cfd-97d4-d937c123e12e",
"signature":
,
"errors": [
],
"status": "fatal",
"metrics":
}
jmunta-mac:cbtest jagadeshmunta$ curl -v -u Administrator:password -d 'SELECT "Hello, beer!" AS greeting' http://172.23.136.145:8095/analytics/service
- Trying 172.23.136.145...
- TCP_NODELAY set
- Connected to 172.23.136.145 (172.23.136.145) port 8095 (#0)
- Server auth using Basic with user 'Administrator'
> POST /analytics/service HTTP/1.1
> Host: 172.23.136.145:8095
> Authorization: Basic QWRtaW5pc3RyYXRvcjpwYXNzd29yZA==
> User-Agent: curl/7.54.0
> Accept: /
> Content-Length: 33
> Content-Type: application/x-www-form-urlencoded
> - upload completely sent off: 33 out of 33 bytes
< HTTP/1.1 400 Bad Request
< connection: keep-alive
< content-type: application/json; charset=UTF-8
< content-length: 336
<
{
"requestID": "c82e4f75-6319-47d7-8cff-d5c8c15f50bf",
"signature": { "*": "*" },
{ "code": 21004, "msg": "No statement provided" }
"errors": [
],
"status": "fatal",
"metrics":}
- Connection #0 to host 172.23.136.145 left intact
Only works when statement= is given.
jmunta-mac:cbtest jagadeshmunta$ curl -v -u Administrator:password -d 'statement=SELECT "Hello, beer!" AS greeting;' http://172.23.136.145:8095/analytics/service
- Trying 172.23.136.145...
- TCP_NODELAY set
- Connected to 172.23.136.145 (172.23.136.145) port 8095 (#0)
- Server auth using Basic with user 'Administrator'
> POST /analytics/service HTTP/1.1
> Host: 172.23.136.145:8095
> Authorization: Basic QWRtaW5pc3RyYXRvcjpwYXNzd29yZA==
> User-Agent: curl/7.54.0
> Accept: /
> Content-Length: 44
> Content-Type: application/x-www-form-urlencoded
> - upload completely sent off: 44 out of 44 bytes
< HTTP/1.1 200 OK
< transfer-encoding: chunked
< connection: keep-alive
< content-type: application/json; charset=UTF-8
< Access-Control-Allow-Headers: Origin, X-Requested-With, Content-Type, Accept
<
{
"requestID": "ff0340d9-6e29-4543-87b3-c9aa72c89936",
"signature": { "*": "*" },
{ "greeting": "Hello, beer!" }
"results": []
{ "elapsedTime": "25.927011ms", "executionTime": "16.213578ms", "resultCount": 1, "resultSize": 31, "processedObjects": 0 }
,
"plans":{},
"status": "success",
"metrics":}
- Connection #0 to host 172.23.136.145 left intact