Use the GET /user
transaction to retrieve the information of the user the service is holding.
A successful /user
transaction returns an object containing all the data fields in the account record.
{ "ok" : true, "status" : "User's account detailes included.", "data" : { "title" : "Dr", "firstname" : "Yi", "middlename" : null, "surname" : "Zhang", "nickname" : "Yi", "position" : null, "company" : "ENSIMS", "email" : "yi@jeplus.org", "tel" : "1234567890", "address" : null, "postcode" : null, "country" : "UK", "website" : null, "twitter" : null, "linkedin" : null, "use_jess" : true, "jess_user" : "TestUser", "jess_pwd" : "hidden" }
Send the /user
command using curl:
curl -b cookies https://api.ensims.com/users/api/user
On success, the user's account details will be returned in a JSON object. If the existing JWT is invalid, an HTTP 401 Unauthorized code will be returned.
Make sure Requests is correctly installed in your Python environment, and run the following lines:
import requests # Existing cookies are expected to be stored in the variable 'cookies' r = requests.get('https://api.ensims.com/users/api/user', cookies=cookies) # Show returned object r.json()
A successful operation will return the JSON content such as the following:
{ "ok" : true, "status" : "User's account detailes included.", "data" : { "title" : "Dr", "firstname" : "Yi", "middlename" : null, "surname" : "Zhang", "nickname" : "Yi", "position" : null, "company" : "ENSIMS", "email" : "yi@jeplus.org", "tel" : "1234567890", "address" : null, "postcode" : null, "country" : "UK", "website" : null, "twitter" : null, "linkedin" : null, "use_jess" : true, "jess_user" : "TestUser", "jess_pwd" : "hidden" } }