Items

Permissions

Permission to view, create, edit and delete items is governed by the group a staff member is a part of.


cb_createItem

Create a new item and return the ID of the newly created item.

Request

string $auth_string Your authentication token returned from cb_setAuthCredentials()
string $name The item name
string $description A brief description
float $cost The cost of a single unit of this item
int $track Enables/disables inventory tracking. Valid values are:
0 - Disabled
1 - Enabled
int $quantity The quantity of this item available. This value is only used if inventory tracking has been enabled.

Response

int item_id

cb_editItem

Edit an item using a given item_id. All values are optional when updating an item. To ignore updating a field, leave the parameter blank.

Request

string $auth_string Your authentication token returned from cb_setAuthCredentials()
int $item_id The item ID
string $name optional; The item name
string $description optional;A brief description
float $cost optional;The cost of a single unit of this item
int $track optional; Enables/disables inventory tracking. Valid values are:
0 - Disabled
1 - Enabled
int $quantity optional; The quantity of this item available. This value is only used if inventory tracking has been enabled.

Response

boolean update_success

cb_deleteItem

Delete an item using the given item_id. Invalid item IDs will be ignored.

Request

string $auth_string Your authentication token returned from cb_setAuthCredentials()
int $item_id The item ID

Response

No response is generated by this function call

cb_getItem

Retrieve information on a single item using the given item_id.

Request

string $auth_string Your authentication token returned from cb_setAuthCredentials()
int $item_id The item ID

Response

Array
(
    [item_id] => 1
    [name_en] => Item #1
    [description_en] => This is item #1
    [unit_cost] => 10.00
    [track] => 1
    [inventory_quantity] => 500
)

cb_getItems

Retrieve an array of all items ordered by a given column.

Request

string $auth_string Your authentication token returned from cb_setAuthCredentials()
int $sort_column optional; The column to sort items on. The valid columns that can be used in this function are those returned by the cb_getItem() function.

Response

Array
(
    [0] => Array
    (
        [item_id] => 1
        [name_en] => Item #1
        [description_en] => This is item #1
        [unit_cost] => 10.00
        [track] => 1
        [inventory_quantity] => 500
    ),
    [1] => Array
    (
        [item_id] => 2
        [name_en] => Item #2
        [description_en] => This is item #2
        [unit_cost] => 5.00
        [track] => 0
        [inventory_quantity] => 0
    )
)

cb_exportItemsCSV

Returns information for all items in a comma separated format. Entries in the returned string are separated by a newline character.

Request

string $auth_string Your authentication token returned from cb_setAuthCredentials()
int $limit optional; Limit the number of results that are returned.
int $offset optional; By default Clientbill will start with item_id = 1. This paramater allows a different starting item_id to be used.

Response

1,Item #1,This is item #1,10.00,1,500
2,Item #2,This is item #2,5.00,0,0

cb_exportItemsXML

Returns information for all items in XML format.

Request

string $auth_string Your authentication token returned from cb_setAuthCredentials()
int $limit optional; Limit the number of results that are returned.
int $offset optional; By default Clientbill will start with item_id = 1. This paramater allows a different starting item_id to be used.

Response

<?xml version="1.0" standalone="yes"?>
<cbExportData>
   <item>
      <item_id>1</item_id>
      <name_en>Item #1</name_en>
      <description_en>This is item #1</description_en>
      <unit_cost>10.00</unit_cost>
      <track>1</track>
      <inventory_quantity>500</inventory_quantity>
   </item>
   <item>
      <item_id>2</item_id>
      <name_en>Item #2</name_en>
      <description_en>This is item #2</description_en>
      <unit_cost>5.00</unit_cost>
      <track>0</track>
      <inventory_quantity>0</inventory_quantity>
   </item>
</cbExportData>