meta data for this page
Back to Users / JESS / JEA / JBODY API
Log Off
Use the log-out transaction to log off the service and clear the session token.
Synopsis
- Method: POST
- Cookie: “session_token=<existing JWT>”
- Header: none
- Body: none
- Success: Void auth return object
- Error: HTTP 401 - Unauthorized
Authorization return object
A successful log-out return object contains the status flag, message, and a void JWT in the cookies.
{ "ok": true, "status": "Logged out successfully!", "jwt": "Session token cleared" }
Example using curl://
Send the log-out command using curl:
curl -b cookies -c cookies -X POST https://api.ensims.com/users/api/logout
On successful log-out, an Auth return object with 'OK' status will be received with a void JWT in the cookies. The -c
option effectively clears the save token. 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 requests # Existing cookies are expected to be stored in the variable 'cookies' r = requests.post('https://api.ensims.com/users/api/logout', cookies=cookies) # Update the cookies cookies = r.cookies # Show returned object r.json()
A successful operation will return the JSON content such as the following:
{ "ok" : true, "status" : "Logged out successfully!", "jwt" : "Session token cleared", "user" : null, "role" : null, "email" : null }