Creating a session

The docs on how to create a session via the sync-gateway public rest api are a little unclear. Could I get some clarification?

In 1.1 it says to post a Json document with just the name and password but in 1.2 this doesn’t appear to be an option, at least it’s not in the docs.

@nick-couchbase

For 1.2 that’s a docs issue, I have created a ticket for that, although it possible it’s already been fixed but not published yet.

The following example works against SG 1.2

curl -v -X POST http://localhost:4984/db/_session -H \"Content-Type: application/json" -d '{ "name":"test","password":"test" }'

Response:

POST /todolite/_session HTTP/1.1
> User-Agent: curl/7.39.0
> Host: localhost:4984
> Accept: */*
> Content-Type: application/json
> Content-Length: 45
> 
* upload completely sent off: 45 out of 45 bytes
< HTTP/1.1 200 OK
< Content-Length: 128
< Content-Type: application/json
< Server: Couchbase Sync Gateway/1.2 branch/HEAD(nobranch) commit/826c2e2+CHANGES
< Set-Cookie: SyncGatewaySession=c89e043e5f37a165752f9d2ce5225d8de8777947; Path=/todolite; Expires=Fri, 04 Mar 2016 14:49:11 GMT
< Date: Thu, 03 Mar 2016 14:49:11 GMT
< 
* Connection #0 to host localhost left intact
{"authentication_handlers":["default","cookie"],"ok":true,"userCtx":{"channels":{"!":1,"list--crashtest":6},"name":"crashtest"}}