Before using the API, please make sure you have obtained the following credentials.

  • Application ID (App ID)
  • Application Secret Key (App Key)
  • Access Token
  • Access Token Secret

These credentials can be found in the "integration" page of the owner's menu. You must also ensure that the Status is set to ENABLED.




The API can be used by making POST or GET requests, depending on the function, with a basic URL format. This format is as follows: 

 

http://app.clientbookcrm.com/api{version}/{api_family}/{api_function}/{additional_parameter_value}?app_id={application_id}&app_key={application_key}&token={access_token}&secret={access_token_secret}&{other_GET_parameter}

 

Replace word in { } with the proper conditions.

  • {version}

    Replace the version parameter with the API version you are making requests to. The currently API version is v1.

  • {api_family}

    Replace the API family parameter with one from the list of API families:

    • license
    • purchase
    • repairs
    • specialorders
    • wishlist
    • clients
    • vendors
  • {api_function}

    Replace the API function parameter from its API family. The list of API functions for each family name will be discussed in the next topics.

  • {additional_parameter_value}

    Replace the addtional parameter with additional parameters required by the API function you are making the request to, if any. In an API family function, if there is colon (:variable) after the API function name, it indicates there are additional parameters to send.

  • {application_id}

    Replace the Application ID parameter with your Application ID value.

  • {application_key}

    Replace the Application Secret Key parameter with your Secret Key value.

  • {access_token}

    Replace the Access Token parameter with your Access Token value.

  • {access_token_secret}

    Replace the Access Token Secret parameter with the Access Token Secret value.

  • {other_GET_parameter}

    Replace the other GET parameter with related parameters for the API function you are making the request to. For example:


    &cid=1&limit=2

     


How to tell if a function uses POST or GET


In the API Families, there is a sign [POST] or [GET] before the function name to indicate whether this function uses POST or GET.


Examples


Below is an example of making a request to the API to get all active repairs sorted by due date, using the credentials from image above.

 

http://app.clientbookcrm.com/apiv1/repairs/active/?app_id=8f6b091af493c3c77&app_key=cb44722a-1e44-41c8-d8a9-68758b0a0754&token=clientbookcrm&secret=58f46b4792a135521003b526d792e0ff&order=due_date

 

Below is the example of making an API request to get a repairs with the ID 2332770927, using the credentials from image above.


http://app.clientbookcrm.com/apiv1/repairs/view/id/2332770927?app_id=8f6b091af493c3c77&app_key=cb44722a-1e44-41c8-d8a9-68758b0a0754&token=clientbookcrm&secret=58f46b4792a135521003b526d792e0ff

 

Libraries


Here is a list of library that can be used to make the API calls easier.


PHP


Download Library


Usage


Do not forget to include the library in your PHP files first. Then you can initialize the class using the rule method below.


require_once 'ClientBookCRM.php';
	$ClientBookCRM = new ClientBookCRM('{application_id}','{application_key}','{access_token}','{access_token_secret}');
	$parameter = array(
			'{parameter_name_1}' => '{parameter_value_1}',
			'{parameter_name_2}' => '{parameter_value_2}',
		); // contains list of POST or other_GET_parameter and its value
	$post = $ClientBookCRM->{api_method}('{api_family}/{api_function}/{additional_parameter_value}',$parameter);

 

Possible {api_method} value: GET | POST


Note:


You can set public variable $crm_host_url and $version to match the Client Book CRM API URL and version.


Use $ClientBookCRM to communicate with the Client Book CRM API.


Here are some function that can be used.


  

$ClientBookCRM->getAccessToken('username','password');

To get the access token for certain username and password

$ClientBookCRM->post('api_url',$parameter);

To access the API with [POST] type. api_url is written in format: api_family/api_function

$parameter is an array contains all data that will be posted, and is written in format:
$parameter['field_name'] = 'value';
$ClientBookCRM->get(‘api_url’,$parameter);

To access the API with [GET] type. api_url is written in format: api_family/api_function

$parameter is an array contains all data that will be posted or embed in the api_url, and is written in format:
$parameter['field_name'] = 'value';

 


Usage examples


Use the POST method

 

		$ClientBookCRM = new ClientBookCRM('8f6b091af493c3c77','cb44722a-1e44-41c8-d8a9-68758b0a0754','clientbookcrm','58f46b4792a135521003b526d792e0ff');
		$parameter = array();
		$parameter['client_id'] = "5134794505";
		$parameter['client_last_name'] = "last name api1";
		$post_return = $ClientBookCRM->post('clients/edit',$parameter);
		var_dump($post_return);


Use the GET method with additional_parameter_value


		$ClientBookCRM = new ClientBookCRM('8f6b091af493c3c77','cb44722a-1e44-41c8-d8a9-68758b0a0754','indra2','58f46b4792a135521003b526d792e0ff');
		$get_return = $ClientBookCRM->get('wishlist/view/id/72944558');
		var_dump($get_return);

 

Use GET method without additional_parameter_value

 

		$ClientBookCRM = new ClientBookCRM('8f6b091af493c3c77','cb44722a-1e44-41c8-d8a9-68758b0a0754','indra2','58f46b4792a135521003b526d792e0ff');
		$parameter = array();
		$parameter['order'] = "created";
		$parameter['q'] = "2500";
		$get_return = $ClientBookCRM->get('wishlist/list',$parameter);
		var_dump($get_return);