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

Note: “sign” word refer to significant other or spouse

1) anniversary - anniversary date

2) client_birth_date - client birth date (format: yyyy-mm-dd hh:ii:ss)

3) client_cell_phone

4) client_city

5) client_city_2

6) client_email

7) client_finger_size

8) client_first_name

9) client_id - the primary key or the unique client ID

10) client_image - client’s image/photo

11) client_last_name

12) client_state

13) client_state_2

14) client_street_address

15) client_street_address_2

16) apartment

17) apartment_2

18) client_tags - client's interests

19) client_home_phone

20) client_work_phone

21) client_zip

22) client_zip_2

23) client_gender - valid values are: male, female, unknown

24) contact_preference

25) date_entered - when the client was added (format: yyyy-mm-dd hh:ii:ss)

26) date_contacted - date the client was last contacted (format: yyyy-mm-dd hh:ii:ss)

27) sign_birth_date - client significant other's birth date (format: yyyy-mm-dd hh:ii:ss)

28) sign_bracelet_size

29) sign_cell_phone

30) sign_email

31) sign_finger_size

32) sign_first_name

33) sign_zip

34) sign_zip_2

35) sign_city

36) sign_city_2

37) sign_street_address

38) sign_street_address_2

39) sign_apartment

40) sign_apartment_2

41) sign_image - significant other's Image/photo

42) sign_last_name

43) sign_contact_preference

44) sign_necklace_size

45) sign_home_phone

46) sign_state

47) sign_state_2

48) sign_work_phone

49) sign_gender valid values are: male, female, unknown

50) user_id - Client Book CRM user_id or inventory ID of the user who added the client

51) store - the store ID of the storewhere the client was added 

52) update_date - the date of the last update (format: yyyy-mm-dd hh:ii:ss)

53) heard_about_us - how the client heard about you. The value are: ‘radio’, ‘tv’, ‘news’, ‘referral’, ‘internet’, ‘walkin’, ‘email’, ‘mails’, ‘billboard’, ‘none’

54) latitude - the latitude of client’s location (used for generating heatmap reports)

55) longitude the longitude of client’s location (used for generating heatmap reports)

56) visibility - whether the user is required to be a manager or higher to view the client or not. The value are: ‘all’, ‘management’

57) new_inventory_id the primary key or ID in your database. (e.g database in user’s server that is synchronized or linked with the Client Book CRM database). Empty value indicates there is any changes in Client Book CRM database and need to be synchronized again, not empty indicates it has been synchronized.

58) old_inventory_id the primary key or ID in your database, obtained after the first synchronization process (e.g database in user’s server that is synchronized or linked with the Client Book CRM database).

Note: if both new_inventory_id and old_inventory_id are empty, the purchase has not synchronized with other database. If old_inventory_id is not empty and new_inventory_id is empty, it means there are some changes on the purchase information, so it needs to be synchronized again.

Function List:

a. [GET] list

Retrieve all registered clients

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

Parameters:

- order : to sort the result by specific value. Default is created.

Value: update | created

- 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 client_first_name, client_last_name, client_email

- cid : contains specific client id. Use either cid or cinvid, but not both

- cinvid : contains specific client inventory_id. Use either cid or cinvid, but not both

b. [GET] new

Retrieve all clients which are new and have not been synchronized with the third-party database.

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

Parameters:

- order : to sort the result by specific value. Default is created.

Value: update | created

- 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 client_first_name, client_last_name, client_email

- cid : contains specific client id. Use either cid or cinvid, but not both

- cinvid : contains specific client inventory_id. Use either cid or cinvid, but not both

c. [GET] edited

Retrieve all clients which have been updated and have not been synchronized with the third-party database.

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

Parameters:

- order : to sort the result by specific value. Default is created.

Value: update | created

- 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 client_first_name, client_last_name, client_email

- cid : contains specific client id. Use either cid or cinvid, but not both

- cinvid : contains specific client inventory_id. Use either cid or cinvid, but not both

d. [POST] saveinventory

Save the inventory_id (ID got from the synchronization process, ID from third-party database) into Client Book CRM database.

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

Parameters:

- inventory_id : ID got from the synchronization process (ID from third-party database, mandatory)

- client_id : local client ID which is being synchronized (mandatory)

e. [GET] view/:type/:id

Get specific client by its’ ID.

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

Parameters:

:type : inventory | id

:id : the id or inventory_id of the specific client. id is an ID in Client Book CRM database, inventory_id is an ID got from synchronization process.

f. [GET] delete/:client_id

Delete a client.

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

Parameters:

- :client_id : Client Book CRM client ID (mandatory)

g. [POST] add

Add a client into Client Book CRM database.

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

Parameters:

- client_first_name (mandatory)

- client_last_name (mandatory)

- client_birth_date

- anniversary

- client_email

- client_image

- client_street_address

- client_street_address_2

- apartment

- apartment_2

- client_city

- client_city_2

- client_state

- client_state_2

- client_zip

- client_zip_2

- client_home_phone

- client_cell_phone

- client_work_phone

- contact_preference

- client_finger_size

- client_gender - valid values are: male, female, unknown

- heard_about_us

- sign_first_name

- sign_last_name

- sign_birth_date

- sign_contact_preference

- sign_email

- sign_image

- sign_street_address

- sign_street_address_2

- sign_apartment

- sign_apartment_2

- sign_city

- sign_city_2

- sign_state

- sign_state_2

- sign_zip

- sign_zip_2

- sign_home_phone

- sign_cell_phone

- sign_work_phone

- sign_finger_size

- sign_bracelet_size

- sign_necklace_size

- sign_gender : valid values are: male, female, unknown

- client_tags_id : array of client_tags_id to add client interests. List of client_tags_id can be found using API [GET] options in client API family

- team_user_id : array of user_id to be added as client guardians. Guardian is an employee who will serve the client and can find the client in their “My Client” Client Book CRM website menu

- inventory_id (if filled, it will add an inventory_id for the item)

h. [POST] edit

Update a client from Client Book CRM database

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

Parameters:

- client_id : the client ID which is being updated (mandatory)

- client_first_name (mandatory, if edited)

- client_last_name (mandatory, if edited)

- client_birth_date

- anniversary

- client_email

- client_image

- client_street_address

- client_street_address_2

- apartment

- apartment_2

- client_city

- client_city_2

- client_state

- client_state_2

- client_zip

- client_zip_2

- client_home_phone

- client_cell_phone

- client_work_phone

- contact_preference

- client_finger_size

- client_gender à valid values are: male, female, unknown

- heard_about_us

- sign_first_name

- sign_last_name

- sign_birth_date

- sign_contact_preference

- sign_email

- sign_image

- sign_street_address

- sign_street_address_2

- sign_apartment

- sign_apartment_2

- sign_city

- sign_city_2

- sign_state

- sign_state_2

- sign_zip

- sign_zip_2

- sign_home_phone

- sign_cell_phone

- sign_work_phone

- sign_finger_size

- sign_bracelet_size

- sign_necklace_size

- sign_gender : valid values are: male, female, unknown

- client_tags_id : array of client_tags_id to be added to client interests. List of client_tags_id can be found using API [GET] options in client API family

- team_user_id : array of user_id to be added as client guardians. Guardian is an employee who will serve the client and can find the client in their “My Client” Client Book CRM website menu

i. [GET] detail/:client_id

Get specific client by its’ ID.

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

Parameters:

:client_id : Client Book CRM client ID

j. [GET] options

Get the options available for adding or editing client. The options are: “heard_about_us”, “employee” (list of users to be added as guardians of the client), “client_interest” (list of tags/interests to be added to the client)

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

Parameters:

none