Use the POST /user transaction to update account record.
Content-Type
to application/json
The available fields in the user's account data are listed below. When submitting the object to update the record, any fields that are omitted or have a null
value will be ignored. Please note that the jess_user
and the jess_pwd
fields should be set using the session
transaction in the JESS API to take effect.
{ "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" }
A successful transaction return object contains the status flag and a message, as shown below.
{ "ok" : true, "status": "Account details updated successfully!" }
An HTTP 401 - Unauthorized response will be received if the existing token is invalid.
Assuming the session token has been saved in the cookies
file using the log on command, send the confirm command using curl in Linux as below:
curl -b cookies -H 'Content-Type: application/json' -X POST -d '{"title": "Mr", "position": "Director"}' https://api.ensims.com/users/api/user
If successful, a transaction return object with 'OK' status will be received. You can check the updated record by issuing the GET /user again. If the session token is invalid, an HTTP 401 code will be returned.
Make sure Requests is correctly installed in your Python environment, and run the following lines:
import requests headers = {'Content-Type': 'application/json'} body = {"title": "Mr", "position": "Director"} # Make a post request. Session token must be available in the saved cookies during log-on r = requests.post('https://api.ensims.com/users/api/user', headers=headers, json=body, cookies=cookies) # Show return info r.json()
A successful operation will return the JSON content such as the following:
{ "ok": true, "status": "Account details updated successfully!", "session": null }