meta data for this page
Set/Update JESS Session
Use POST /session
with JESS account credential to set or update the JESS session associated with the user's ENSIMS Web Service account.
Synopsis
- Method: POST
- Cookies: JWT session token
- Header: Set
Content-Type
toapplication/json
- Body: JESS credential object
- Success: Session update return object
- Failed: Session update failed or HTTP 401 - Unauthorized
JESS Account Credential
The JESS account credential is composed of a JESS username and password pair. You can only obtain a JESS account by filling out this form. This JSON object is sent in the request's body with the transaction.
{ "jessUser": "--------", "jessPwd": "********" }
Return Object
If the JESS credential is accepted, a new session key will be assigned to the user's ENSIMS Web Service account, and the user will be ready to run simulations. A successful return object contains the status flag and a message, as shown in the example below.
{ "ok" : true, "status" : "New JESS session key is assigned.", "data" : null }
Session Update Failed
If the supplied JESS credential does not match anything on the server, a Failed response will be received:
{ "ok" : false, "status": "The supplied user and passwd pair does not match any record on JESS.", "data": null }
Authorization Failed
An HTTP 401 - Unauthorized response will be received
Example using curl://
Assuming the session token has been saved in the cookies
file using the log on command, send the confirm command using curl on Linux as below:
curl -b cookies -H 'Content-Type: application/json' -X POST -d '{"jessUser": "--------", "jessPwd": "********"}' https://api.ensims.com/jess_web/api/session
on Windows:
curl -b cookies -H "Content-Type: application/json" -X POST -d "{\"jessUser\": \"--------\", \"jessPwd\": \"********\"}" https://api.ensims.com/jess_web/api/session
Example using Python Requests
Make sure Requests is correctly installed in your Python environment, and run the following lines:
import requests headers = {'Content-Type': 'application/json'} body = {"jessUser": "--------", "jessPwd": "********"} # Make a post request. Session token must be available in the saved cookies during log-on r = requests.post('https://api.ensims.com/jess_web/api/session', headers=headers, json=body, cookies=cookies) # Show return info r.json()