User API guide: Difference between revisions

Marked this version for translation
No edit summary
Line 9: Line 9:
}}
}}
</translate>
</translate>
<br><be>
<br>


<translate>
<translate>
Line 20: Line 20:
<!--T:4-->
<!--T:4-->
See [https://simplybook.me/api_example/index.html an example of API-based booking interface], and also read [https://simplybook.me/api_example/scheduler.js the source code] of this solution.
See [https://simplybook.me/api_example/index.html an example of API-based booking interface], and also read [https://simplybook.me/api_example/scheduler.js the source code] of this solution.
<br><br><be>
<br><br>


</translate>
</translate>
Line 126: Line 126:
)
)
));</nowiki>
));</nowiki>
<br><br><be>
<br><br>


</translate>
</translate>
Line 143: Line 143:
<!--T:11-->
<!--T:11-->
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.
<br><be>
<br>


</translate>
</translate>
Line 182: Line 182:
//    'qty' => 1, performer quantity
//    'qty' => 1, performer quantity
// ), ...)</nowiki>
// ), ...)</nowiki>
<br><be>
<br>


</translate>
</translate>
Line 190: Line 190:
<!--T:13-->
<!--T:13-->
The next step to a client is to pick a date and time of his service. We've used a Bootstrap date-picker in API-usage example, you can also use this or any other calendar. To set your calendar first date use getFirstWorkingDay method. It can take employee id as a parameter and returns the next date when the selected employee (or any employee in the company by default) is avaiable for booking. To show time slots inside a selected date you need getWorkCalendar and getStartTimeMatrix methods. The first method give you an information about working day start and end time, and about day-offs. And the second one returns the list of time-slots which can be booked for a certain date.
The next step to a client is to pick a date and time of his service. We've used a Bootstrap date-picker in API-usage example, you can also use this or any other calendar. To set your calendar first date use getFirstWorkingDay method. It can take employee id as a parameter and returns the next date when the selected employee (or any employee in the company by default) is avaiable for booking. To show time slots inside a selected date you need getWorkCalendar and getStartTimeMatrix methods. The first method give you an information about working day start and end time, and about day-offs. And the second one returns the list of time-slots which can be booked for a certain date.
<br><be>
<br>


</translate>
</translate>
Line 208: Line 208:
//    ...
//    ...
//);</nowiki>
//);</nowiki>
<br><be>
<br>


</translate>
</translate>
Line 227: Line 227:
//    '2015-03-04' => array('09:00:00', '09:30:00', '10:00:00', ....),
//    '2015-03-04' => array('09:00:00', '09:30:00', '10:00:00', ....),
//);</nowiki>
//);</nowiki>
<br><be>
<br>
 
</translate>
</translate>


Line 235: Line 234:
<!--T:16-->
<!--T:16-->
Another usefull method you may need is calculateEndTime. Each service can have its own duration, also your company's employees possible have different work schedule form day to day. So using this method you can show to a client an end date and time of the service he've booked in a correct way.
Another usefull method you may need is calculateEndTime. Each service can have its own duration, also your company's employees possible have different work schedule form day to day. So using this method you can show to a client an end date and time of the service he've booked in a correct way.
<br><be>
<br>


</translate>
</translate>
Line 250: Line 249:
// returns '2015-03-03 10:00:00'
// returns '2015-03-03 10:00:00'
</nowiki>
</nowiki>
<br><be>
<br>


</translate>
</translate>
Line 258: Line 257:
<!--T:18-->
<!--T:18-->
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 [https://simplybook.me/api/doc 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 [https://simplybook.me/api/doc 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><be>
<br><br>


</translate>
</translate>
Line 268: Line 267:
<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 Custom Feature in 'Custom Features' 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><be>
<br>


</translate>
</translate>
Line 300: Line 299:
     }
     }
}</nowiki>
}</nowiki>
<br><be>
<br>


</translate>
</translate>
Line 321: Line 320:
// 'value' => null
// 'value' => null
// )), ...)</nowiki>
// )), ...)</nowiki>
<br><br><be>
<br><br>


</translate>
</translate>
Line 331: Line 330:
<br><br>
<br><br>
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.
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><be>
<br><br>


</translate>
</translate>
Line 377: Line 376:


<!--T:32-->
<!--T:32-->
<br><be>
<br>


</translate>
</translate>