Changes

no edit summary
Line 46: Line 46:  
));</nowiki>
 
));</nowiki>
 
<br><br>
 
<br><br>
==USER/ADMIN API (COMPANY ADMINISTRATION SERVICE) AUTHORIZATION==
+
==User/Admin API (Company Administration Service) Authorization==
 
'''Authorization from client side code'''<br><br>
 
'''Authorization from client side code'''<br><br>
 
Getting the token-key.<br><br>
 
Getting the token-key.<br><br>
Line 79: Line 79:  
));</nowiki>
 
));</nowiki>
   −
==GETTING DATA FROM SIMPLYBOOK SERVER==
+
==Getting Data from SimplyBook Server==
 
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 multy-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 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 additional fields, making some group or multy-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 Simplybook API methods.
   Line 150: Line 150:  
When a client clicks confirm booking button you have to call book method. This is the main function which performs all necessary validations and registers a new booking in Simplybook system. It takes information about booking, client data like name and phone and some additional params. See all params descriptions of this method in API functions list. The book method responce contains an uniqe code and other details of the new booking or the list of errors if some problems occured, so you can use this information to show booking result to a client in convinient and intuitive way.
 
When a client clicks confirm booking button you have to call book method. This is the main function which performs all necessary validations and registers a new booking in Simplybook system. It takes information about booking, client data like name and phone and some additional params. See all params descriptions of this method in API functions list. The book method responce contains an uniqe code and other details of the new booking or the list of errors if some problems occured, so you can use this information to show booking result to a client in convinient and intuitive way.
 
<br><br>
 
<br><br>
==USING OF API SECRET KEY==
+
==Using of API Secret Key==
 
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 plugin in 'Plugins' list.
   Line 189: Line 189:  
// 'value' => null
 
// 'value' => null
 
// )), ...)</nowiki>
 
// )), ...)</nowiki>
==SIMPLYBOOK PLUGINS==
+
==SimplyBook Plugins==
 
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 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.
   −
==BOOKING FUNCTIONALITY CODEFLOW==
+
==Booking Functionality Codeflow==
Authorize in Simplybook API using loginClient.getToken(companyLogin, apiKey); function.
      +
Authorize in Simplybook API using '''loginClient.getToken(companyLogin, apiKey);''' function.
   −
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 getCategoriesList().
      +
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()].
   −
Get list of services (events) and performers (units) using getEventList() and 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 geUnitList()] 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 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 getCompanyParam("any_unit__hide_other_units") is enabled.
      +
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.
   −
Use getStartTimeMatrix ($from as current date, $to as current date, $eventId, $unitId, $count as selected participants value ) to get available timeslots for given date. $unitId should be null if Any employee option is selected.
      +
Use [https://simplybook.me/en/api/doc#getStartTimeMatrix getStartTimeMatrix ($from as current date, $to as current date, $eventId, $unitId, $count as selected participants value )] to get available timeslots for given date. '''$unitId''' should be null if Any employee option is selected.
   −
If Any Employee selector is active and Any employee was selected call getAvailableUnits($eventId, $dateTime, $count) to get available $unitId
      +
If Any Employee selector is active and Any employee was selected call [https://simplybook.me/en/api/doc#getAvailableUnits getAvailableUnits($eventId, $dateTime, $count)] to get available $unitId
   −
If Additional fields plugin is activated isPluginActivated("event_field") call getAdditionalFields($eventId) function to get list of fields for client to fill.
      +
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.
   −
Call 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.