Developer:SessionCookie

From myExperiment

Jump to: navigation, search

The session controller requires just a username and password to give you a session cookie. This is done by posting a document like the following to http://www.myexperiment.org/session/create (Remember to set the Content-Type of your POST request to application/xml):

 <session>
   <username>myusername</username>
   <password>mypassword</password>
 </session>

You can test drive this using curl:

$ curl -D headers.txt -H 'Content-Type: application/xml' -d '<session><username>myusername</username><password>mypassword</password></session>' 'http://www.myexperiment.org/session/create'

This then gets you a session cookie. An example cookie header (which the above curl invocation will save to headers.txt) is:

 Set-Cookie: _m2_session_id=4fc0c2532e983352200d817a4513ae96; path=/

With this, you can then specify the session cookie to authenticate further requests, e.g.:

$ curl -b _m2_session_id=4fc0c2532e983352200d817a4513ae96 http://www.myexperiment.org/workflow.xml?id=56

If you need any further help about authentication, please contact Don Cruickshank.

Personal tools