All functions return a set of fields from database. An explanation of the fields is included below.

1) user_id - the user / employee primary key

2) username

3) password

4) name

5) email

6) permissions - 0 is employee, 1 is manager, 2 is owner/admin

7) store - Client Book CRM store_id of the store that the user belongs to

9) owner_subscribe_manager value: ‘Y’ or ‘N’. Y means Yes, N means No. This field indicates whether the owner subscribes to manager email notifications or not.

10) status - 0 is not active (user can’t login), 1 is active (user can login). In function add and edit, status value is “enable” or “disable”

11) update_date

12) guardian_notification - value: “disable” or “enable”. This is to indicate whether the user / employee will get guardian notifications

13) store_notification - value: “disable” or “enable”. This is to indicate whether the user / employee will get store notifications. Only for manager permissions (1) and owner permissions (2)

14) company_notification - value: “disable” or “enable”. This is to indicate whether the user / employee will get store notifications. Only for owner permissions (2)

15) employee_reminders - value: “disable” or “enable”. This is to indicate whether the user / employee will get a reminders regarding clients and client events.

Function List: 

a. [GET] list

Retrieve all stores within company

Return content in “data” field. “data” is in array format.

Parameters:

- limit : to set the number of the data displayed. If not set, it will return all data. In order to use this parameter, from must be set too.

- from : to set the number where to start displaying the data set (offset). If not set, it will return all data. In order to use this parameter, limit must be set too.

- q : keyword to search. Search in username or name

- username: keyword get certain username

- store: keyword to filter users / employees from specific store_id

b. [GET] detail/:id

Get specific user by its’ ID.

Return content in “data” field. “data” is in array format.

Parameters:

- :id : the Client Book CRM user id (mandatory)

c. [GET] delete/:id

Delete a user / employee.

Return content in “message” field. “message” is in string format, either error message or success message.

Parameters:

- :id : Client Book CRM user ID (mandatory)

d. [POST] add

Add a user into Client Book CRM database.

Return content in “data” field. “data” is an array of current inputted data or a empty string. “message” field contains either error message or success message.

Parameters:

- username (mandatory and must be unique in Client Book CRM database)

- password (mandatory)

- email (mandatory)

- permissions (mandatory)

- store (mandatory and must exists)

- name

- status (value: “enable” or “disable”, default “enable”)

- guardian_notification

- store_notification (only if the permissions is manager [1] or owner [2], others will be useless)

- company_notification (only if the permissions is owner [2], others will be useless)

- employee_reminders

e. [POST] edit/:id

Update a user / employee from Client Book CRM database. Please take a note that if you change password for the employee / username that is the same as current API access token, it will change the API access token secret and your next API call will be invalid.

Return content in “data” field. “data” is in string format, either error message or empty string (success).

Parameters:

- id : the user / employee ID which is being updated (mandatory)

- username (mandatory and must be unique in Client Book CRM database, if edited)

- password (mandatory, if edited)

- email (mandatory, if edited)

- permissions (mandatory, if edited)

- store (mandatory and must exists, if edited)

- name

- status (value: “enable” or “disable”, default “enable”)

- guardian_notification

- store_notification (only if the permissions is manager [1] or owner [2], others will be useless)

- company_notification (only if the permissions is owner [2], others will be useless)

- employee_reminders