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

1) owner_id Client Book CRM client_id or inventory ID of the client

2) date_entered - when the special order was added (format: yyyy-mm-dd hh:ii:ss)

3) due_date - when the special order is due (format: yyyy-mm-dd hh:ii:ss)

4) description - item description

5) id - the primary key or the special order ID

6) price - the price of the item

7) sku - stock keeping unit of the item

8) store - store ID of the store where the item was added

9) style_number - style number of the item

10) user_id - the CRM or Inventory ID of the user who adds the special order

11) vendor - Client Book CRM vendor ID of the item's vendor

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

13) license - the company license registered in Client Book CRM

14) archive - flag whether the special order is in archived (‘Y’) or active (‘N’)

15) is_completed - flag whether the special order is completed (‘Y’) or not (‘N’)

16) completed_date - the date when the special order is completed (format: yyyy-mm-dd hh:ii:ss)

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

18) 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 special orders, which archive is set to ‘N’

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.

- sku : to search special order with specific stock keeping unit.

- q : keyword to search. Search in field client_first_name, client_last_name, client_email, due_date, description, price, sku, style_number, vendor.name, users.name (user’s name), users.email (user’s 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] archive

Retrieve all archive special orders, which archive is set to ‘Y’

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.

- sku : to search special order with specific stock keeping unit.

- q : keyword to search. Search in field client_first_name, client_last_name, client_email, due_date, description, price, sku, style_number, vendor.name, users.name (user’s name), users.email (user’s 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] new

Retrieve all special orders 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.

- sku : to search special orders with specific stock keeping unit.

- q : keyword to search. Search in field client_first_name, client_last_name, client_email, due_date, description, price, sku, style_number, vendor.name, users.name (user’s name), users.email (user’s 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. [GET] edited

Retrieve all special orders 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.

- sku : to search special order with specific stock keeping unit.

- q : keyword to search. Search in field client_first_name, client_last_name, client_email, due_date, description, price, sku, style_number, vendor.name, users.name (user’s name), users.email (user’s 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

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 special order ID which is being synchronized (mandatory)

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

Get specific special order 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 special order. 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 special order 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 special order

:type : refer to special order status, ‘archive’, ‘active’, ‘complete’, ‘uncomplete’

h. [POST] delete

Delete a special order item.

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

Parameters:

- id : Client Book CRM special order ID (mandatory)

i. [POST] add

Add a special order into Client Book CRM database.

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

Parameters:

- due_date (mandatory)

- description (mandatory)

- price (mandatory)

- client_id (mandatory)

- vendor (mandatory)

- sku

- style_number

- 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 special order 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)

- due_date (mandatory, if edited)

- description (mandatory, if edited)

- price (mandatory, if edited)

- client_id (mandatory, if edited)

- vendor (mandatory, if edited)

- sku

- style_number