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

1) vendor_id - the vendor primary key which uses auto-increment. Do not use it. Please use “id” field instead. 

2) account - vendor account number

3) city

4) corp_number - corporate number

5) email

6) fax_number

7) id the primary key or the vendor ID

8) name

9) note

10) phone

11) rep - the name of your contact with the vendor

12) state - vendor state address

13) street - vendor street address

14) user_id - Client Book CRM user_id or inventory ID of the user who added the vendor

15) web - vendor website URL

16) zip - vendor zip code

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

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

19) 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 vendors

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 name, phone, email, city

b. [GET] view/:id

Get specific vendor by its’ ID.

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

Parameters:

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

c. [POST] delete

Delete a vendor.

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

Parameters:

- id : Client Book CRM vendor ID (mandatory)

d. [POST] add

Add a vendor into Client Book CRM database.

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

Parameters:

- name (mandatory)

- web

- street

- city

- state

- zip

- email

- phone

- fax_number

- corp_number

- inventory_id

- account

- note

e. [POST] edit/:id

Update a vendor from Client Book CRM database

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

Parameters:

- id : the vendor ID which is being updated (mandatory)

- name (mandatory, if edited)

- web

- street

- city

- state

- zip

- email

- phone

- fax_number

- corp_number

- account

- note