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

1) archived - Whether the repair is archived or not

2) owner_id Client Book CRM user_id or inventory ID of user who added the repair

3) contacted - Whether the customer has been contacted

4) contacted_date the date that the contact occured (format: yyyy-mm-dd hh:ii:ss)

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

6) due_date - when the repair is due (format: yyyy-mm-dd hh:ii:ss)

7) id - the primary key or the repair ID

8) item - item name

9) description repair description

10) price_estimate - repair cost estimate

11) received indicates whether the item was received (1) or not (0)

12) received_date - the date when the item was received (format: yyyy-mm-dd hh:ii:ss)

13) sent - indicates whether the item is sent (1) or not (0)

14) sent_date the date when the item was sent (format: yyyy-mm-dd hh:ii:ss)

15) sent_where - where the item was sent

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

17) image - item image server URL

18) client_id - the ID of the customer or client whose item is to be repaired

19) status à the status of the repair. Statuses are: ‘SENT’, ‘CLIENT CONTACTED’, ‘RECEIVED’, ‘ADDED’, ‘COMPLETED’

20) condition - condition of the item

21) requested_repair à does not have any meaning

22) 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.

23) 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] active

Retrieve all active repair, which status is not ‘COMPLETED’

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

Parameters:

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

Value: due_date | 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 field client_first_name, client_last_name, client_email, users.name (user’s name), users.email (user’s email), price_estimate, due_date

- 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] archive

Retrieve all archive repair, which status is ‘COMPLETED’

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

Parameters:

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

Value: due_date | 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 field client_first_name, client_last_name, client_email, users.name (user’s name), users.email (user’s email), price_estimate, due_date

- 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] new

Retrieve all repairs 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: due_date | 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 field client_first_name, client_last_name, client_email, users.name (user’s name), users.email (user’s email), price_estimate, due_date

- 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. [GET] edited

Retrieve all repairs 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: due_date | 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 field client_first_name, client_last_name, client_email, users.name (user’s name), users.email (user’s email), price_estimate, due_date

- 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

e. [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)

- id : local repair ID which is being synchronized (mandatory)

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

Get specific repair item 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 repair. id is an ID in Client Book CRM database, inventory_id is an ID got from synchronization process.

g. [GET] change_status/:id/:type

Change the repair status.

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

Parameters:

:id : the id of the specific Client Book CRM repair

:type : refer to repair status. ‘SENT’, ‘CONTACTED’, ‘RECEIVED’, ‘ADDED’, ‘COMPLETED’

h. [POST] delete

Delete a repair item.

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

Parameters:

- id : Client Book CRM repair ID (mandatory)

i. [POST] add

Add a repair item into Client Book CRM database.

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

Parameters:

- description

- price_estimate

- item (mandatory)

- owner_id

- condition

- sent_date

- received_date

- due_date

- sent_where

- client_id (mandatory)

- sent

- received

- image

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

- client_inventory_id : client’s inventory_id in Client Book CRM database

j. [POST] edit/:id

Update a repair item from Client Book CRM database

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

Parameters:

- :id : Client Book CRM ID which is being updated (mandatory)

- description

- price_estimate

- item (mandatory)

- condition

- due_date

- sent_where

- status

- sent

- received

- image