N1QL Rest API возвращает 404 - PullRequest
1 голос
/ 16 октября 2019

Я пытался использовать N1QL Query в качестве конечной точки REST API для доступа к данным, но получал ошибку 404. Есть ли что-то, что нужно настроить на сервере couchbase для поддержки N1Q1 Rest API?

http://127.0.0.1:8091/query/service?statement=select%20a.name,r.destinationairport,%20count(a.name)%20total_flights%20from%20travel-sample%20r%20join%20travel-sample%20a%20on%20keys%20r.airlineid%20where%20r.type%20=%22route%22%20and%20a.type=%22airline%22%20group%20by%20r.destinationairport,%20a.name%20order%20by%20r.destinationairport

1 Ответ

1 голос
/ 16 октября 2019
The bucket name `travel-sample` has special characters so you need to use escaped identifier (back ticks).

Служба запросов работает на порту 8093. Также необходимо отправить REST API на порт 8093.

Вы также можете попробовать это.

curl -v http://localhost:8093/query/service -H "Content-Type: application/json"  -d '{"statement":"select a.name,r.destinationairport,count(a.name) AS total_flights from `travel-sample` r join `travel-sample` a on keys r.airlineid where r.type = "route" and a.type="airline" group by r.destinationairport, a.name order by r.destinationairport", "creds":[{"user":"user","pass":"xxxx"}]}'
...