In this guide, we will learn how to use BookingSync API using PHP language and our dedicated PHP lib.
We will here run get_rentals example. This example use oauth2 bookingsync php. PHP 5.4 is required here.
Clone this repository into your web server. e.g: /var/www/
Create a new Vhost
<VirtualHost *:80>
ServerName bsa-rest-php.dev
DocumentRoot /var/www/rest-request-php/examples/api-v3/
<Directory /var/www/rest-request-php/examples/api-v3/>
AllowOverride All
Order Allow,Deny
Allow from All
</Directory>
</VirtualHost>
Applications that want to use the API need to be registered in the partner panel on BookingSync.com.
If you are not a partner yet, it’s free to signup so join us :)
Click on New Application
button
REST PHP
get_rentals
example, so: https://bsa-rest-php.dev/get_rentals.phpOn the right side, select Standalone
and Private
Once your application is created, copy the Private App Access Code
. Then go to the Admin panel > Apps
and paste this code inside Instal a Private App
.
Open examples > api-v3 > get_rentals.php
file.
We need to change l.15-17 to tell him how to use our BookingSync application previouly created.
Go to you Partner Panel
and click on manage
and copy/paste Client ID
and Client Secret
into this file. Same for redirectUri
.
If you go now to https://bsa-rest-php.dev/get_rentals.php
you should be able to see the result of this example.