无法在 Couchbase Sync Gateway 中创建用户
Cannot create user in Couchbase Sync Gateway
我有一个 运行 同步网关实例,它与数据桶相连。我用初始用户配置了网关:
"firstuser": {
"disabled": false,
"password": "abc"
}
同步网关网络视图准确显示了这个单一用户。现在我想通过 REST 添加另一个用户 api:
curl -H 'Content-Type: application/json' -H 'Accept: application/json' -X POST -d '{"name":"raphi", "password":"abc"}' http://192.168.1.150:4995/_admin/db/test/_user/
或
curl -H 'Content-Type: application/json' -H 'Accept: application/json' -X PUT -d '{"password":"abc"}' http://192.168.1.150:4995/_admin/db/test/_user/raphi
结果是没有创建用户,webview 仍然只显示一个(初始)用户。此外,我得到了一个无用的 html-代码答案:
<!DOCTYPE html>
<html>
<head>
<meta http-equiv='Content-type' content='text/html; charset=utf-8'>
<title>Couchbase Sync Gateway</title>
<style>/* global tags */
* {
box-sizing: border-box;
}
...
</head>
<body>
<div id="container"></div>
<script>...</script>
</body>
</html>
编辑:我刚刚尝试通过向 /test/_session/
发送带有 {"name":"raphi"}
的 POST 来使用身份验证 API。这也会导致 HTML 页面响应而不是 the documented JSON data。所以这似乎是一个普遍的 API 问题...
愚蠢的我! URL 完全错误:它不应该包含 _admin/db/
。因此,正确的 URL 将是:
http://192.168.1.150:4995/test/_user/
http://192.168.1.150:4995/test/_user/raphi
这解决了我的问题。
curl -X PUT http://127.0.0.1:4985/test/demo@abc.com --data '{"password":"12345678", "name":"demo@abc.com"}'
curl -H 'Content-Type: application/json' -X POST -d '{"name":"mohammad", "password":"123","admin_channels":["mohammad","public"]}' http://192.168.1.137:4985/grocery/_user/
我有一个 运行 同步网关实例,它与数据桶相连。我用初始用户配置了网关:
"firstuser": {
"disabled": false,
"password": "abc"
}
同步网关网络视图准确显示了这个单一用户。现在我想通过 REST 添加另一个用户 api:
curl -H 'Content-Type: application/json' -H 'Accept: application/json' -X POST -d '{"name":"raphi", "password":"abc"}' http://192.168.1.150:4995/_admin/db/test/_user/
或
curl -H 'Content-Type: application/json' -H 'Accept: application/json' -X PUT -d '{"password":"abc"}' http://192.168.1.150:4995/_admin/db/test/_user/raphi
结果是没有创建用户,webview 仍然只显示一个(初始)用户。此外,我得到了一个无用的 html-代码答案:
<!DOCTYPE html>
<html>
<head>
<meta http-equiv='Content-type' content='text/html; charset=utf-8'>
<title>Couchbase Sync Gateway</title>
<style>/* global tags */
* {
box-sizing: border-box;
}
...
</head>
<body>
<div id="container"></div>
<script>...</script>
</body>
</html>
编辑:我刚刚尝试通过向 /test/_session/
发送带有 {"name":"raphi"}
的 POST 来使用身份验证 API。这也会导致 HTML 页面响应而不是 the documented JSON data。所以这似乎是一个普遍的 API 问题...
愚蠢的我! URL 完全错误:它不应该包含 _admin/db/
。因此,正确的 URL 将是:
http://192.168.1.150:4995/test/_user/
http://192.168.1.150:4995/test/_user/raphi
这解决了我的问题。
curl -X PUT http://127.0.0.1:4985/test/demo@abc.com --data '{"password":"12345678", "name":"demo@abc.com"}'
curl -H 'Content-Type: application/json' -X POST -d '{"name":"mohammad", "password":"123","admin_channels":["mohammad","public"]}' http://192.168.1.137:4985/grocery/_user/