Users

 

Create a user

To create a new user, use POST method.

POST  /api/users

Request:

POST /api/users?username=Lucylamrin&password=jessy787lucy&displayname=Lucy& group=Sales&email=lucy@xcompany.com&phone=112234566

email & phone are optional.
Response:

Status: 200 OK  {"success":true}  or   {"success":false,"message":"Loginname already exists!"}

 

Update a user

For updating a user account, use PUT method.
Request:

PUT  /api/users/[user]?username=Lucylamrin&displayname=Lucy&group=Sales&email=lucy@xcompany.com&phone=04562272323&previous_password=jessy787lucy&password=lucylamrin007
[user] – Previous username or Previous email. username, displayname, email, group, phone are optional.
To change password, previous_password is required.

Response:

Status: 200 OK { "success":true }

 

Delete a user

For deleting purpose use DELETE method.
Request:

 DELETE /api/users/[user]
[user] – Username or Email.

Response:

Status: 200 OK { "success":true }

 

Retrieve a user

For retrieving a user, use GET Method.
Request:

 GET /api/users/[user]
[user] – Username or Email.

Response:

Status: 200 OK  {  "row":{  "username":"sam",  "displayname":"Sam",  "group":"Sales",  "role":"M",  "email":"sam@xcompany.com",  "phone":"",  "status":"offline"  },  "success":true  }

 

Retrieve all users

You can use GET method for retrieving all users.
Response:

GET /api/users/

Response:

Status: 200 OK { "rows":[ { "username":"JohnJenifer", "displayname":"John", "group":"Administration", "role":"A", "email":"", "phone":1234568790, "status":"online" }, { "username":"sam", "displayname":"Sam", "group":"Sales", "role":"M", "email":"sam@xcompany.com", "phone":"", "status":"offline" } ],  "success":true }

 

Retrieve users by status

You can use GET method to get the status of the user.
Request:

GET /api/users?status=online or offline

Response:

Status: 200 OK { "row":{ "username":"sam", "displayname":"Sam", "group":"Sales", "role":"M", "email":"sam@xcompany.com", "phone":"", "status":"online" }, "success":true }

 

Set personal message for a user

You can use POST method, for providing your personal details.
Request:

POST  /api/users/[user]?message=In meeting 
[user] – Username or Email.

Response:

Status: 200 OK  {  "success" : true  }