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 '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'.
+
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.
Line 25: 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 33: 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 44: 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 63: 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 71: 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 83: 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 97: 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 203: 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 230: Line 230:       −
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.
      Line 242: Line 242:       −
If Additional Fields 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.
+
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.