Clients

Permissions

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


cb_createClient

Create a new client and return the ID of the newly created client. If no password is set, one with be generated automatically.

Request

string $auth_string Your authentication token returned from cb_setAuthCredentials()
string $first_name A client's first name
string $last_name A client's last name
string $email A valid email address that does not already exist in the Clientbill database
string $password A password for the new account. If left blank a password will automatically be generated.
boolean $send_email If set to true, sends an account created email to the client
array $info optional; An associative array of additional information that can be filled in during the client creation process. The valid labels for this array are:
[string] country
[string] address1
[string] address2
[string] city
[string] state
[string] postal_code
[string] title
[string] office_phone
[string] mobile_phone
[string] home_phone
[string] fax
[string] im_name
[string] im_type
[string] notes

Response

int client_id

cb_editClient

Edit a client account using a given client_id. Any value specified in cb_createClient, except password, can be used to update the client's information.

Request

string $auth_string Your authentication token returned from cb_setAuthCredentials()
int $client_id The client_id of the account information to be updated
array $updated_values An associative array of fields to update. All valid labels to use in this array are:
[string] first_name
[string] last_name
[string] email
[string] country
[string] address1
[string] address2
[string] city
[string] state
[string] postal_code
[string] title
[string] office_phone
[string] mobile_phone
[string] home_phone
[string] fax
[string] im_name
[string] im_type
[string] notes

Response

boolean update_success

cb_deleteClient

Delete a client account using the given client_id. Invalid client IDs will be ignored.

Request

string $auth_string Your authentication token returned from cb_setAuthCredentials()
int $client_id The client_id of the account information to be updated

Response

No response is generated by this function call

cb_getClient

Retrieve account information for a single client using a givent client_id.

Request

string $auth_string Your authentication token returned from cb_setAuthCredentials()
int $client_id The client_id of the account information to be updated

Response

Array(
      [user_id] => 1,
      [create_date] => 1182526556,
      [last_login] => 1182529713,
      [first_name] => John,
      [last_name] => Doe,
      [email] => johndoe@email.com,
      [password] => john_doe_pass,
      [company] => John Doe Business,
      [country] => United States,
      [address1] => 100 Doe Avenue,
      [address2] => Apartment #2,
      [city] => New York,
      [state] => New York,
      [postal_code] => 10004,
      [title] => Developer,
      [office_phone] => 555-555-5555,
      [mobile_phone] => 555-555-5556,
      [home_phone] => 555-555-5557,
      [fax] => 555-555-5558,
      [im_name] => JohnDoe,
      [im_type] => AIM,
      [notes] => Client notes,
      [credit] => 43.50,
)

cb_getClientEstimates

Return an array of estimate IDs for a given client_id. If no estimates exist for the given client, a blank array will be returned.

Request

string $auth_string Your authentication token returned from cb_setAuthCredentials()
int $client_id The client_id of the account information to be updated

Response

Array(
      [0] => 13,
      [1] => 17,
      [2] => 26,
      [3] => 109,
)

cb_getClientInvoices

Return an array of invoice IDs for a given client_id. If no invoices exist for the given client, a blank array will be returned.

Request

string $auth_string Your authentication token returned from cb_setAuthCredentials()
int $client_id The client_id of the account information to be updated

Response

Array(
      [0] => 6,
      [1] => 55,
      [2] => 88,
      [3] => 104,
      [4] => 222,
)

cb_getClients

Return an ordered list of client data. Each entry in the list will be an array similar to the one returned by cb_getClient().

Request

string $auth_string Your authentication token returned from cb_setAuthCredentials()
string $sort_column The column to sort the return clients list on. This can be any field specified in the cb_createClient or cb_editClient functions.

Response

Array(
      [0] => Array(
             [user_id] => 1,
             [create_date] => 1182526556,
             [last_login] => 1182529713,
             [first_name] => John,
             [last_name] => Doe,
             [email] => johndoe@email.com,
             [password] => john_doe_pass,
             [company] => John Doe Business,
             [country] => United States,
             [address1] => 100 Doe Avenue,
             [address2] => Apartment #2,
             [city] => New York,
             [state] => New York,
             [postal_code] => 10004,
             [title] => Developer,
             [office_phone] => 555-555-5555,
             [mobile_phone] => 555-555-5556,
             [home_phone] => 555-555-5557,
             [fax] => 555-555-5558,
             [im_name] => JohnDoe,
             [im_type] => AIM,
             [notes] => Client notes,
             [credit] => 43.50,
      ),
      [1] => Array(
             [user_id] => 2,
             [create_date] => 1192526556,
             [last_login] => 1192620718,
             [first_name] => Jane,
             [last_name] => Doe,
             [email] => janedoe@email.com,
             [password] => jane_doe_pass,
             [company] => Jane Doe Business,
             [country] => United States,
             [address1] => 101 Doe Avenue,
             [address2] => Suite #4,
             [city] => New York,
             [state] => New York,
             [postal_code] => 10004,
             [title] => Designer,
             [office_phone] => 555-555-5559,
             [mobile_phone] => 555-555-5550,
             [home_phone] => 555-555-5551,
             [fax] => 555-555-5552,
             [im_name] => JaneDoe,
             [im_type] => Yahoo,
             [notes] => Client notes,
             [credit] => 0.00,
      ),
)

cb_exportClientsCSV

Return account information for all clients 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 client_id = 1. This paramater allows a different starting client_id to be used.

Response

1,1182526556,1182529713,John,Doe,johndoe@email.com,john_doe_pass,John Doe Business,United States,100 Doe Avenue,Apartment #2,New York,New York,10004,Developer,555-555-5555,555-555-5556,555-555-5557,555-555-5558,JohnDoe,AIM,Client notes,43.50 2,1192526556,1192620718,Jane,Doe,janedoe@email.com,jane_doe_pass,Jane Doe Business,United States,101 Doe Avenue,Suite #4,New York,New York,10004,Designer,555-555-5559,555-555-5550,555-555-5551,555-555-5552,JaneDoe,Yahoo,Client notes,0.00

cb_exportClientsXML

Return account information for all clients 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 client_id = 1. This paramater allows a different starting client_id to be used.

Response

<?xml version="1.0" standalone="yes"?>
<cbExportData>
    <client>
        <user_id>1</user_id>
        <create_date>1182526556</create_date>
        <last_login>1182529713</last_login>
        <first_name>John</first_name>
        <last_name>Doe</last_name>
        <email>johndoe@email.com</email>
        <password>john_doe_pass</password>
        <company>John Doe Business</company>
        <country>United States</country>
        <address1>100 Doe Avenue</address1>
        <address2>Apartment #2</address2>
        <city>New York</city>
        <state>New York</state>
        <postal_code>10004</postal_code>
        <title>Developer</title>
        <office_phone>555-555-5555</office_phone>
        <mobile_phone>555-555-5556</mobile_phone>
        <home_phone>555-555-5557</home_phone>
        <fax>555-555-5558</fax>
        <im_name>JohnDoe</im_name>
        <im_type>AIM</im_type>
        <notes>Client notes</notes>
        <credit>43.50</credit>
    </client>
    <client>
        <user_id>2</user_id>
        <create_date>1192526556</create_date>
        <last_login>1192620718</last_login>
        <first_name>Jane</first_name>
        <last_name>Doe</last_name>
        <email>janedoe@email.com</email>
        <password>jane_doe_pass</password>
        <company>Jane Doe Business</company>
        <country>United States</country>
        <address1>101 Doe Avenue</address1>
        <address2>Suite #4</address2>
        <city>New York</city>
        <state>New York</state>
        <postal_code>10004</postal_code>
        <title>Designer</title>
        <office_phone>555-555-5559</office_phone>
        <mobile_phone>555-555-5550</mobile_phone>
        <home_phone>555-555-5551</home_phone>
        <fax>555-555-5552</fax>
        <im_name>JaneDoe</im_name>
        <im_type>Yahoo</im_type>
        <notes>Client notes</notes>
        <credit>0.00</credit>
    </client>
</cbExportData>