I am calling the API through an external app and I need to pass the session id as http request header. However none of my attempt to set the cookie header worked.

has anyone an idea of what I am doing wrong ?

Here is the main process I use:

//the session id was grabbed from the login response cookie header
var theCookie = "_session_id=XXXXXXXXXXXXXXXXXXX";

//addHeader is a local function to add header to a http request

//don't work
addHeader("Cookie", theCookie );

//don't work
addHeader("Set-Cookie", theCookie );

//don't work
addHeader("cookie", theCookie );

//don't work
addHeader("set-cookie", theCookie );

Any ideas ?

Thanks in advance,