Changes

no edit summary
Line 9: Line 9:  
='''AUTHORIZATION'''=
 
='''AUTHORIZATION'''=
 
<br><br>
 
<br><br>
Using Simplybook API methods require an authentication. To authorize in Simplybook API you need to get an access key — access-token. In order to get this access-token you should call the JSON-RPC method getToken on http://user-api.simplybook.me/login service passing your personal API-key. You can copy your API-key at admin interface: go to the 'Plugins' link and select API plugin 'Settings'. Then you have to init remote access to Simplybook API. Your request should contain the following headers: 'X-Company-Login', 'X-Token'.
+
Using Simplybook API methods require an authentication. To authorize in Simplybook API you need to get an access key — access-token. In order to get this access-token you should call the JSON-RPC method getToken on https://user-api.simplybook.me/login service passing your personal API-key. You can copy your API-key at admin interface: go to the 'Custom Features' link and select API Custom Feature 'Settings'. Then you have to init remote access to Simplybook API. Your request should contain the following headers: 'X-Company-Login', 'X-Token'.
    
Getting the access-token can be implemented either from client side or from your server which is the more secure solution.
 
Getting the access-token can be implemented either from client side or from your server which is the more secure solution.
    
You may use [https://simplybook.me/api_example/json-rpc-client.js javascript JSON-RPC-client library] and [https://simplybook.me/api_example/JsonRpcClient.zip php JSON-RPC-client library] from our examples for your own solution development.
 
You may use [https://simplybook.me/api_example/json-rpc-client.js javascript JSON-RPC-client library] and [https://simplybook.me/api_example/JsonRpcClient.zip php JSON-RPC-client library] from our examples for your own solution development.
 +
 +
Please note access-token has one hour one time. This is done for security reasons. You will need to regenerate it at least once per hour.
 
<br><br><br>
 
<br><br><br>
 +
 
='''CLIENT API([https://simplybook.me/api/doc#/admin COMPANY PUBLIC SERVICE])AUTHORIZATION'''=
 
='''CLIENT API([https://simplybook.me/api/doc#/admin COMPANY PUBLIC SERVICE])AUTHORIZATION'''=
 
<br><br>
 
<br><br>
Line 22: Line 25:  
<br><br>
 
<br><br>
 
  <nowiki>var loginClient = new JSONRpcClient({
 
  <nowiki>var loginClient = new JSONRpcClient({
'url': 'http://user-api.simplybook.me' + '/login',
+
'url': 'https://user-api.simplybook.me' + '/login',
 
'onerror': function (error) {},
 
'onerror': function (error) {},
 
});
 
});
Line 30: Line 33:  
<br><br>
 
<br><br>
 
  <nowiki>this.client = new JSONRpcClient({
 
  <nowiki>this.client = new JSONRpcClient({
'url': 'http://user-api.simplybook.me',
+
'url': 'https://user-api.simplybook.me',
 
'headers': {
 
'headers': {
 
'X-Company-Login': YOUR_COMPANY_LOGIN,
 
'X-Company-Login': YOUR_COMPANY_LOGIN,
Line 41: Line 44:  
<br><br>
 
<br><br>
 
'''Getting the token-key.'''<br><br>
 
'''Getting the token-key.'''<br><br>
  <nowiki>$loginClient = new JsonRpcClient('http://user-api.simplybook.me' . '/login/');
+
  <nowiki>$loginClient = new JsonRpcClient('https://user-api.simplybook.me' . '/login/');
 
$token = $loginClient->getToken(YOUR_COMPANY_LOGIN, YOUR_API_KEY);</nowiki>
 
$token = $loginClient->getToken(YOUR_COMPANY_LOGIN, YOUR_API_KEY);</nowiki>
 
<br><br>
 
<br><br>
 
'''Initialization JSON-RPC-client.'''
 
'''Initialization JSON-RPC-client.'''
 
<br><br>
 
<br><br>
  <nowiki>$client = new JsonRpcClient('http://user-api.simplybook.me' . '/', array(
+
  <nowiki>$client = new JsonRpcClient('https://user-api.simplybook.me' . '/', array(
 
     'headers' => array(
 
     'headers' => array(
 
         'X-Company-Login: ' . YOUR_COMPANY_LOGIN,
 
         'X-Company-Login: ' . YOUR_COMPANY_LOGIN,
Line 60: Line 63:  
<br><br>
 
<br><br>
 
  <nowiki>var loginClient = new JSONRpcClient({
 
  <nowiki>var loginClient = new JSONRpcClient({
'url': 'http://user-api.simplybook.me' + '/login',
+
'url': 'https://user-api.simplybook.me' + '/login',
 
'onerror': function (error) {},
 
'onerror': function (error) {},
 
});
 
});
Line 68: Line 71:  
<br><br>
 
<br><br>
 
  <nowiki>this.client = new JSONRpcClient({
 
  <nowiki>this.client = new JSONRpcClient({
'url': 'http://user-api.simplybook.me' + '/admin/',
+
'url': 'https://user-api.simplybook.me' + '/admin/',
 
'headers': {
 
'headers': {
 
'X-Company-Login': YOUR_COMPANY_LOGIN,
 
'X-Company-Login': YOUR_COMPANY_LOGIN,
Line 80: Line 83:  
'''Getting the token-key.'''
 
'''Getting the token-key.'''
 
<br><br>
 
<br><br>
  <nowiki>$loginClient = new JsonRpcClient('http://user-api.simplybook.me' . '/login/');
+
  <nowiki>$loginClient = new JsonRpcClient('https://user-api.simplybook.me' . '/login/');
 
$token = $loginClient->getUserToken(YOUR_COMPANY_LOGIN, YOUR_USER_LOGIN, YOUR_USER_PASSWORD);</nowiki>
 
$token = $loginClient->getUserToken(YOUR_COMPANY_LOGIN, YOUR_USER_LOGIN, YOUR_USER_PASSWORD);</nowiki>
 
<br><br>
 
<br><br>
 
'''Initialization JSON-RPC-client.'''
 
'''Initialization JSON-RPC-client.'''
 
<br><br>
 
<br><br>
  <nowiki>$client = new JsonRpcClient('http://user-api.simplybook.me' . '/admin/', array(
+
  <nowiki>$client = new JsonRpcClient('https://user-api.simplybook.me' . '/admin/', array(
 
'headers' => array(
 
'headers' => array(
 
'X-Company-Login: ' . YOUR_COMPANY_LOGIN,
 
'X-Company-Login: ' . YOUR_COMPANY_LOGIN,
Line 94: Line 97:  
='''GETTING DATA FROM SIMPLYBOOK SERVER'''=
 
='''GETTING DATA FROM SIMPLYBOOK SERVER'''=
 
<br><br>
 
<br><br>
A booking page usually is a page where clients choose service they need, an employee and a time of their meeting. Then a client enters some contact info and confirms the booking. The more complex solutions may include filling different additional fields, making some group or multi-times booking and so on. Lets describe the workflow of creation the simpliest booking page. Then if you need to add some extra functionality to your page, see here the full list of [https://simplybook.me/api/doc Simplybook API methods].
+
A booking page usually is a page where clients choose service they need, an employee and a time of their meeting. Then a client enters some contact info and confirms the booking. The more complex solutions may include filling different intake forms, making some group or multi-times booking and so on. Lets describe the workflow of creation the simpliest booking page. Then if you need to add some extra functionality to your page, see here the full list of [https://simplybook.me/api/doc Simplybook API methods].
    
So the first thing you should display is the list of services and the list of employes. Get this data by getEventList and getUnitList methods. They both return a list with complete information about each item in it, so you have many possibilities how to display services and employees at your page. To make employee filtration use unit_map property of the service list, it contains the info about employees who can provide the selected service.
 
So the first thing you should display is the list of services and the list of employes. Get this data by getEventList and getUnitList methods. They both return a list with complete information about each item in it, so you have many possibilities how to display services and employees at your page. To make employee filtration use unit_map property of the service list, it contains the info about employees who can provide the selected service.
Line 173: Line 176:  
='''USING OF API SECRET KEY'''=
 
='''USING OF API SECRET KEY'''=
 
<br><br>
 
<br><br>
In some cases the book method may require the confirmation, e.g. if your accept payments from clients you confirm booking only after the payment is already came. The Simplybook API confirmBookng method takes booking-id and secure signature as params (another method which requires secure signature is cancelBookng). For the secure signature generation your secret API-key should be used. See how it can be done in the example below. You can find the secret key at admin interface under 'Settings' link of API plugin in 'Plugins' list.
+
In some cases the book method may require the confirmation, e.g. if your accept payments from clients you confirm booking only after the payment is already came. The Simplybook API confirmBookng method takes booking-id and secure signature as params (another method which requires secure signature is cancelBookng). For the secure signature generation your secret API-key should be used. See how it can be done in the example below. You can find the secret key at admin interface under 'Settings' link of API Custom Feature in 'Custom Features' list.
 
<br><br>
 
<br><br>
 
'''Code example of service booking and its confirmation using secret API key'''
 
'''Code example of service booking and its confirmation using secret API key'''
Line 200: Line 203:  
}</nowiki>
 
}</nowiki>
 
<br><br>
 
<br><br>
'''Code example of getting additional fields'''
+
'''Code example of getting intake forms'''
 
<br><br>
 
<br><br>
 
  <nowiki>$fields = $client->getAdditionalFields($eventId);
 
  <nowiki>$fields = $client->getAdditionalFields($eventId);
Line 215: Line 218:  
// )), ...)</nowiki>
 
// )), ...)</nowiki>
 
<br><br><br>
 
<br><br><br>
='''SIMPLYBOOK PLUGINS'''=
+
='''SIMPLYBOOK CUSTOM FEATURES'''=
 
<br><br>
 
<br><br>
If your company specific requires some additional functionality you can activate some of our additional plugins. The complete plugin list with detailed description is avaiable in your admin interface under the 'Plugins' link. After the necessary plugin is enabled the corresponding API methods will be activated so you can use them in your code.
+
If your company specific requires some additional functionality you can activate some of our additional Custom Features. The complete Custom Features list with detailed description is avaiable in your admin interface under the 'Custom Feature' link. After the necessary Custom Feature is enabled the corresponding API methods will be activated so you can use them in your code.
 
<br><br><br>
 
<br><br><br>
 
='''BOOKING FUNCTIONALITY CODEFLOW'''=
 
='''BOOKING FUNCTIONALITY CODEFLOW'''=
Line 224: Line 227:       −
Check if Service categories plugin is activated by [https://simplybook.me/en/api/doc#isPluginActivated isPluginActivated("event_category")]  if yes then display list of categories [https://simplybook.me/en/api/doc#getCategoriesList getCategoriesList()].
+
Check if Service categories Custom Feature is activated by [https://simplybook.me/en/api/doc#isPluginActivated isPluginActivated("event_category")]  if yes then display list of categories [https://simplybook.me/en/api/doc#getCategoriesList getCategoriesList()].
      −
Get list of services (events) and performers (units) using [https://simplybook.me/en/api/doc#getEventList getEventList()] and [https://simplybook.me/en/api/doc#getUnitList geUnitList()] functions. If "unit_map" array is available for service it means this service can be provided by given performers only.
+
Get list of services (events) and performers (units) using [https://simplybook.me/en/api/doc#getEventList getEventList()] and [https://simplybook.me/en/api/doc#getUnitList getUnitList()] functions. If "unit_map" array is available for service it means this service can be provided by given performers only.
      −
If Any Employee selector plugin is activated [https://simplybook.me/en/api/doc#isPluginActivated isPluginActivated("any_unit")] and no special duration is set for service-performer pair in "unit_map" array then user should be allowed to select Any provider option or choose provider manually. But manual selection of performers should not be possible if [https://simplybook.me/en/api/doc#getCompanyParam getCompanyParam("any_unit__hide_other_units")] is enabled.
+
If Any Employee Selector Custom Feature is activated [https://simplybook.me/en/api/doc#isPluginActivated isPluginActivated("any_unit")] and no special duration is set for service-performer pair in "unit_map" array then user should be allowed to select Any provider option or choose provider manually. But manual selection of performers should not be possible if [https://simplybook.me/en/api/doc#getCompanyParam getCompanyParam("any_unit__hide_other_units")] is enabled.
      Line 239: Line 242:       −
If Additional fields plugin is activated [https://simplybook.me/en/api/doc#isPluginActivated isPluginActivated("event_field")] call [https://simplybook.me/en/api/doc#getAdditionalFields getAdditionalFields($eventId)] function to get list of fields for client to fill.
+
If Intake Forms Custom Feature is activated [https://simplybook.me/en/api/doc#isPluginActivated isPluginActivated("event_field")] call [https://simplybook.me/en/api/doc#getAdditionalFields getAdditionalFields($eventId)] function to get list of fields for client to fill.
 +
 
    +
Call [https://simplybook.me/en/api/doc#book book($eventId, $unitId, $date, $time, $clientData, $additional, $count, $batchId)] to make a booking.
   −
Call [https://simplybook.me/en/api/doc#book book($eventId, $unitId, $date, $time, $clientData, $additional, $count, $batchId)] to make a booking.<br><br>
+
<br><br>