Action disabled: source

Back to JESS API

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

JESS Account Credential

The JESS account credential is composed of a JESS username and password pair. You can obtain a JESS account by following the instructions here. Please note that this is a 2-step process and the credentials you need to use come from the email confirmation generated by the system, not your email address and password you have chosen during the registration on app.ensims.com.

The following 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()