forked from AcuityScheduling/acuity-php
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.php
More file actions
55 lines (45 loc) · 1.07 KB
/
Copy pathindex.php
File metadata and controls
55 lines (45 loc) · 1.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
<?php
require_once(__DIR__.'/../../src/AcuityScheduling.php');
require_once('../utils.php');
// Config:
$config = loadConfig();
list($method, $path) = getRouteInfo();
// Instantiate API class:
$acuity = new AcuityScheduling(array(
'userId' => $config['userId'],
'apiKey' => $config['apiKey'],
'base' => $config['base'] // Optional
));
// Example app:
if ($method === 'GET' && $path === '/') {
include('index.html');
$response = $acuity->request('/me');
echo '<h1>GET /api/v1/me:</h1>';
echo '<pre>';
echo print_r($response, true);
echo '</pre>';
$response = $acuity->request('/blocks', array(
'method' => 'POST',
'data' => array(
'start' => '2015-12-24',
'end' => '2015-12-26',
'calendarID' => 1,
'notes' => 'Christmas!'
)
));
echo '<h1>POST /api/v1/blocks:</h1>';
echo '<pre>';
echo print_r($response, true);
echo '</pre>';
$response = $acuity->request('/appointments', array(
'query' => array(
'max' => 1
)
));
echo '<h1>GET /api/v1/appointments?max=1</h1>';
echo '<pre>';
print_r($response);
echo '</pre>';
} else {
handle404();
}