Back to Users / JESS / JEA / JBODY API

User Check-in operation


User authentication and authorization for ENSIMS Web Service uses the JSON Web Tokens (JWT) mechanism. A JWT token has a limited lifespan, hence the Check-in operation can be performed before other transactions in order to check its validity and get a new token.

Synopsis

Authorization return object

A successful authorization return object contains the status flag, message, user's name, email address, and a new JWT, as shown in the example below.

{
    "ok": true,
    "status": "Session renewed successfully!",
    "jwt" : "Session key cookie",
    "user": "Yi",
    "role" : "user",
    "email": "yi@jeplus.org"
}

Example using curl://

Assuming that you have logged on successfully and saved the session token to the cookies file using the log-on transaction, you can use the following to send the check-in command using cURL:

curl -b cookies -X POST https://api.ensims.com/users/api/checkin

On successful check-in, an Auth return object with 'OK' status will be received with a new JWT. If the existing JWT is invalid, an HTTP 401 Unauthorized code will be received.

Example using Python Requests

Make sure Requests is correctly installed in your Python environment, and run the following the lines:

import request

# Make a post request with the stored cookies from the log on transaction
r = requests.post('https://api.ensims.com/users/api/checkin', cookies=cookies)

# Show the returned info
r.json()

A successful operation will return the JSON content such as the following:

{
  "ok" : true,
  "status" : "Session renewed successfully!",
  "jwt" : "Session key cookie",
  "user" : "Yi",
  "role" : "user",
  "email" : "yi@jeplus.org"
}