How to include the session information in a public API request



This is a simple question, but I can’t figure out how to include the sync gateway session information in my public api requests? I’ve tried including the session id in the cookie field, and adding the cookie name, expiry and session id as separate fields in the request header. What am I missing (I don’t have too much experience with API stuff)?




Here is an example using curl:

Generate a session id:

curl -X POST http://localhost:4985/db/_session -H "Content-Type: application/json" -d '{ "name":"test"}'



You can set the cookie header:

curl -X GET http://localhost:4984/db/doc1 -H "Cookie: SyncGatewaySession=594f37e3940680596592cb6c15a76efcd9290f85"


Sweet thanks! Worked like a charm