Couchbase Sync Gateway V3.0

Hello All. I am trying to write a frontend GUI for the Couchbase Sync Gateway V3.0 EE.
When I create (POST) or update (PUT) a user account:

--- REQUEST ---------------------------------------------------
POST http://win-j83vnfrcf1n:4985/combined/_user/ HTTP/1.1
Authorization: Basic QWRtaW5pc3RyYXRvcjpXaTExZXNkZW4=
Accept: application/json, text/json, text/x-json, text/javascript, application/xml, text/xml
User-Agent: RestSharp/107.3.0.0
Content-Type: application/json; charset=utf-8
Host: win-j83vnfrcf1n:4985
Content-Length: 144
Expect: 100-continue
Accept-Encoding: gzip
Connection: Keep-Alive

{"name":"garth","password":"password","all_channels":["*"],"disabled":false}

--- RESPONSE ---------------------------------------------------
HTTP/1.1 201 Created
Server: Couchbase Sync Gateway/3.0.0 EE
Date: Fri, 29 Apr 2022 11:43:08 GMT
Content-Length: 0

I then request it back to confirm, and find it always sets the all_channels to ! (public) not * as specified:

--- REQUEST ---------------------------------------------------
GET http://win-j83vnfrcf1n:4985/combined/_user/garth HTTP/1.1
Authorization: Basic QWRtaW5pc3RyYXRvcjpXaTExZXNkZW4=
Accept: application/json, text/json, text/x-json, text/javascript, application/xml, text/xml
User-Agent: RestSharp/107.3.0.0
Host: win-j83vnfrcf1n:4985
Accept-Encoding: gzip

--- RESPONSE ---------------------------------------------------
HTTP/1.1 200 OK
Content-Length: 54
Content-Type: application/json
Server: Couchbase Sync Gateway/3.0.0 EE
Date: Fri, 29 Apr 2022 11:44:28 GMT

{"name":"garth","all_channels":["!"],"disabled":false}

I have tried updating and creating new, and neither has any effect. The other fields do however edit correctly. If I edit the object in the Couchbase server, it then works correctly (as in I can replicate documents to the client), but this does not seem to be successful through the API.
image

Is this a known issue or am I missing something?

Many Thanks for any insight
Garth

all_channels is an internally computed, read-only property. You should be using admin_channels if you’re trying to assign channels to users via the REST API.

1 Like

Spot on, thanks for the quick response!