How to include the session information in a public API request

Hey,

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)?

Thanks!

@sam.wilks92

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"}'

response

{"session_id":"594f37e3940680596592cb6c15a76efcd9290f85","expires":"2016-08-17T12:43:46.385118083+01:00","cookie_name":"SyncGatewaySession"}

You can set the cookie header:

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

Sweet thanks! Worked like a charm